Skip to content

Commit

Permalink
Do not show WooPay button on external/affiliate product page (#7589)
Browse files Browse the repository at this point in the history
  • Loading branch information
LCmry authored Nov 2, 2023
1 parent 882b385 commit 3b42d0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions changelog/fix-woopay-button-external-product
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Do not load WooPay button on external/affiliate product pages
5 changes: 5 additions & 0 deletions includes/class-wc-payments-woopay-button-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,11 @@ private function is_product_supported() {
$is_supported = false;
}

// External/affiliate products are not supported.
if ( is_a( $product, 'WC_Product' ) && $product->is_type( 'external' ) ) {
$is_supported = false;
}

// Pre Orders products to be charged upon release are not supported.
if ( class_exists( 'WC_Pre_Orders_Product' ) && WC_Pre_Orders_Product::product_is_charged_upon_release( $product ) ) {
$is_supported = false;
Expand Down

0 comments on commit 3b42d0f

Please sign in to comment.