mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Check the price amount with JS to fix variable products
This commit is contained in:
parent
6de1aa2ae8
commit
33ad9f6d91
2 changed files with 37 additions and 24 deletions
|
@ -331,7 +331,6 @@ class SmartButton implements SmartButtonInterface {
|
|||
if (
|
||||
( is_product() || wc_post_content_has_shortcode( 'product_page' ) )
|
||||
&& ! $not_enabled_on_product_page
|
||||
&& ! $this->is_product_price_total_zero()
|
||||
) {
|
||||
add_action(
|
||||
$this->single_product_renderer_hook(),
|
||||
|
@ -1086,20 +1085,4 @@ class SmartButton implements SmartButtonInterface {
|
|||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
||||
return WC()->cart->get_cart_contents_total() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current product price total is 0.
|
||||
*
|
||||
* @return bool true if is 0, otherwise false.
|
||||
*/
|
||||
protected function is_product_price_total_zero(): bool {
|
||||
if ( ! is_product() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$product = wc_get_product();
|
||||
|
||||
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
||||
return $product && $product->get_price() == 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue