File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
modules/ppcp-wc-subscriptions/src/Helper Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -211,6 +211,21 @@ public function paypal_subscription_id(): string {
211
211
if ( $ product ->get_type () === 'subscription ' && $ product ->meta_exists ( 'ppcp_subscription_plan ' ) ) {
212
212
return $ product ->get_meta ( 'ppcp_subscription_plan ' )['id ' ];
213
213
}
214
+
215
+ if ( $ product ->get_type () === 'variable-subscription ' ) {
216
+ /**
217
+ * The method is defined in WC_Product_Variable class.
218
+ *
219
+ * @psalm-suppress UndefinedMethod
220
+ */
221
+ $ product_variations = $ product ->get_available_variations ();
222
+ foreach ( $ product_variations as $ variation ) {
223
+ $ variation_product = wc_get_product ( $ variation ['variation_id ' ] ) ?? '' ;
224
+ if ( $ variation_product && $ variation_product ->meta_exists ( 'ppcp_subscription_plan ' ) ) {
225
+ return $ variation_product ->get_meta ( 'ppcp_subscription_plan ' )['id ' ];
226
+ }
227
+ }
228
+ }
214
229
}
215
230
216
231
return '' ;
You can’t perform that action at this time.
0 commit comments