Support » Plugin: WooCommerce Elite Licenser addon-lite » Not working with WooCommerce Subscriptions

  • emotionalonlinestorytelling

    (@emotionalonlinestorytelling)


    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.

    https://plugins.trac.wordpress.org/browser/woo-elite-licenser-addon/tags/1.4/woocommerce-product-license-manager.php#L579

    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.

  • You must be logged in to reply to this topic.