mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Add disable button support for variable subscriptions
This commit is contained in:
parent
4f75762096
commit
ab09da9252
1 changed files with 10 additions and 0 deletions
|
@ -211,6 +211,16 @@ class SubscriptionHelper {
|
||||||
if ( $product->get_type() === 'subscription' && $product->meta_exists( 'ppcp_subscription_plan' ) ) {
|
if ( $product->get_type() === 'subscription' && $product->meta_exists( 'ppcp_subscription_plan' ) ) {
|
||||||
return $product->get_meta( 'ppcp_subscription_plan' )['id'];
|
return $product->get_meta( 'ppcp_subscription_plan' )['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $product->get_type() === 'variable-subscription' ) {
|
||||||
|
$product_variations = $product->get_available_variations();
|
||||||
|
foreach ( $product_variations as $variation ) {
|
||||||
|
$variation_product = wc_get_product( $variation['variation_id'] );
|
||||||
|
if ( $variation_product->meta_exists( 'ppcp_subscription_plan' ) ) {
|
||||||
|
return $variation_product->get_meta( 'ppcp_subscription_plan' )['id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue