mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Fix: Prevent subscription price override for non-subscription products
Ensure `.trigger('change')` on `.wc_input_subscription_price` is only called when the selected product type is 'subscription' or 'variable-subscription'. Prevents issue where non-subscription products have their regular price cleared, which was likely triggered indirectly by the Square plugin.
This commit is contained in:
parent
80d7da4df3
commit
b3b44cad12
1 changed files with 12 additions and 1 deletions
|
@ -180,7 +180,18 @@ document.addEventListener( 'DOMContentLoaded', () => {
|
|||
}
|
||||
} );
|
||||
|
||||
jQuery( '.wc_input_subscription_price' ).trigger( 'change' );
|
||||
const $productType = jQuery( '#product-type' );
|
||||
const $subscriptionInput = jQuery( '.wc_input_subscription_price' );
|
||||
|
||||
if (
|
||||
$productType.length &&
|
||||
$subscriptionInput.length &&
|
||||
[ 'subscription', 'variable-subscription' ].includes(
|
||||
$productType.val()
|
||||
)
|
||||
) {
|
||||
$subscriptionInput.trigger( 'change' );
|
||||
}
|
||||
|
||||
const variationProductIds = [
|
||||
PayPalCommerceGatewayPayPalSubscriptionProducts.product_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue