mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Use cart amount on any page
This commit is contained in:
parent
ec50202468
commit
a87eba2044
1 changed files with 4 additions and 4 deletions
|
@ -851,9 +851,10 @@ document.querySelector("#payment").before(document.querySelector("#ppcp-messages
|
|||
}
|
||||
|
||||
$product = wc_get_product();
|
||||
$amount = ( is_a( $product, WC_Product::class ) ) ? wc_get_price_including_tax( $product ) : 0;
|
||||
|
||||
if ( is_checkout() || is_cart() ) {
|
||||
$amount = 0;
|
||||
if ( is_a( $product, WC_Product::class ) ) {
|
||||
$amount = wc_get_price_including_tax( $product );
|
||||
} elseif ( isset( WC()->cart ) ) {
|
||||
$amount = WC()->cart->get_total( 'raw' );
|
||||
}
|
||||
|
||||
|
@ -889,7 +890,6 @@ document.querySelector("#payment").before(document.querySelector("#ppcp-messages
|
|||
'ratio' => $ratio,
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue