Not working with WooCommerce Subscriptions
-
Hello
really an amazing plugin. Thank you very much for your excellent job!
I see in the code that you support WooCommerce Subscriptions, but it doesn’t work for me. I have two issues.
The first issue is that in the function generateLicenseKey() (line 579 of the main file) it’s not detected that the order is related to a subscription.
Modifying your code as following it works for me:
function generateLicenseKey($order_id) { $order = wc_get_order( $order_id ); //checking subscription if( function_exists('wcs_get_subscriptions_for_order')) { $subscriptions_ids = wcs_get_subscriptions_for_order( $order_id, array( 'order_type' => 'any' ) ); foreach( $subscriptions_ids as $subscription_id => $subscription ) if( $subscription->get_parent_id() === $order_id ){ return $this->generateSubscriptionLicenseKey($order, $subscription); } } // it is not subscription $orderMeta = $order->get_meta_data();
…
But then, even if the license is created as a license subscription, when I run the subscription renewal (manually in WooCommerce => Status => Scheduled Actions => Run woocommerce_scheduled_subscription_payment related to the subscription), the plugin creates a new license instead of updating the current one.
Is it something that the plugin does or a bug? In my opinion, when the subscription is renewed also the license should be renewed without creating a new license.
Thank you very much in advance.
- The topic ‘Not working with WooCommerce Subscriptions’ is closed to new replies.