From b891eee708f7a72b6beda63ea499b4d756533141 Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Mon, 18 Dec 2023 17:28:41 -0500 Subject: [PATCH] Add subscription variation support to WooPay button (#7884) Co-authored-by: Guilherme Pressutto --- changelog/fix-7588-woopay-subscription-variation | 5 +++++ includes/class-wc-payments-woopay-button-handler.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelog/fix-7588-woopay-subscription-variation diff --git a/changelog/fix-7588-woopay-subscription-variation b/changelog/fix-7588-woopay-subscription-variation new file mode 100644 index 00000000000..06f44dc9845 --- /dev/null +++ b/changelog/fix-7588-woopay-subscription-variation @@ -0,0 +1,5 @@ +Significance: patch +Type: fix +Comment: Edge case adding subscription_variation to WooPay button supported types + + diff --git a/includes/class-wc-payments-woopay-button-handler.php b/includes/class-wc-payments-woopay-button-handler.php index d69cae52083..44154c29ee7 100644 --- a/includes/class-wc-payments-woopay-button-handler.php +++ b/includes/class-wc-payments-woopay-button-handler.php @@ -272,7 +272,7 @@ public function ajax_add_to_cart() { WC()->cart->add_to_cart( $product->get_id(), $quantity, $variation_id, $attributes ); } - if ( in_array( $product_type, [ 'simple', 'subscription', 'bundle', 'mix-and-match' ], true ) ) { + if ( in_array( $product_type, [ 'simple', 'subscription', 'subscription_variation', 'bundle', 'mix-and-match' ], true ) ) { WC()->cart->add_to_cart( $product->get_id(), $quantity ); }