Skip to content

Commit

Permalink
Hide WooPay button for products with 0 price and do not need shipping
Browse files Browse the repository at this point in the history
  • Loading branch information
alefesouza committed Nov 29, 2024
1 parent 529cf91 commit 56fe843
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion includes/class-wc-payments-woopay-button-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,12 @@ private function is_product_supported() {
$is_supported = false;
}

// Subscription with 0 renewal value and 0 sign up fee.
// Products with 0 total price and do not need shipping.
if ( (int) $product->get_price() === 0 && ! $product->needs_shipping() ) {
$is_supported = false;
}

// Subscription with 0 renewal price and 0 sign up fee.
if ( class_exists( 'WC_Product_Subscription' ) &&
class_exists( 'WC_Product_Subscription_Variation' ) &&
( is_a( $product, 'WC_Product_Subscription' ) || is_a( $product, 'WC_Product_Subscription_Variation' ) ) &&
Expand Down

0 comments on commit 56fe843

Please sign in to comment.