• Resolved bverhoeven

    (@bverhoeven)


    We’re trying to use this plugin in combination with the “official” WooCommerce Subscriptions plugin, version 4.7.0. The authors of that plugin have deprecated a hook used by this plugin in such a way that renewing subscriptions becomes impossible.

    When renewing a subscription (interactively, but this also affects automatic renewals) the following notice is displayed:

    We couldn’t create a renewal order for your subscription, please try again.

    This is caused by a WP_Error thrown by the subscription plugins filter deprecator:

    Hook wcs_renewal_order_meta_query is deprecated since version subscriptions-core 2.5.0! Use wc_subscriptions_renewal_order_data instead.

    This hook is used by the sequential order number plugin’s “remove renewal order number” functionality.

    Temporarily removing the filter/hook from the sequential order number plugin does fix the renewal issues, but will probably have bigger impacts. I’d love some advice on how to proceed. I couldn’t immediately find a way to report issues, so I hope this forum is okay.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @bverhoeven,

    Thanks for reaching out.

    We were not able to replicate the issue when we tested the scenario with the mentioned ?WooCommerce Subscriptions?plugin, version 4.7.0. The renewal orders are going through without any issues by maintaining the sequential order series.

    However, since you are facing the issue, it will be nice if you could share with us the WooCommerce system status report (WooCommerce>status>system status report) and the error page screenshot via this link to have a better understanding.

    Thread Starter bverhoeven

    (@bverhoeven)

    Hi @webtoffeesupport,

    Thanks your response.

    Apologies, the issue as described earlier does exist, but its severity is a lot lower than it initially turned out to be. Renewing subscriptions is possible, and is not directly impeded.

    The original issue, that prevented renewals from working at all, was caused by an unrelated plugin in my development setup that was catching all PHP warnings and rethrowing them as ErrorException. This also affected the deprecation warning caused by the wcs_renewal_order_meta_query hook.

    I’d still love to get the deprecation warning fixed. I can still reproduce the issue with WP_DEBUG_DISPLAY enabled, in which case a manual renewal shows the following deprecation notice, and prevents the redirect from happening:

    Deprecated: Hook wcs_renewal_order_meta_query is <strong>deprecated</strong> since version subscriptions-core 2.5.0! Use wc_subscriptions_renewal_order_data instead. in /var/www/html/wp-includes/functions.php on line 5758
    
    Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-includes/functions.php:5758) in /var/www/html/wp-includes/pluggable.php on line 1416
    
    Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-includes/functions.php:5758) in /var/www/html/wp-includes/pluggable.php on line 1419

    Please see a similar issue (with the same issue, but for a slightly different hook) that I reported for another plugin:

    https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/issues/460

    And their fix:

    https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/pull/462/files

    Please let me know if you can reproduce the issue by enabling WP_DEBUG_DISPLAY and triggering a manual renewal through “My Account > Subscriptions > [..] > Renew now”. If you can’t, I’d be more than happy to include more information.

    Our website is also affected by the deprecated filter use error. Whether or not you can replicate it, why would you not improve the plugin by discontinuing use of the deprecated filter?

    Example of the error:

    [Thu Jan 19 14:58:18.503599 2023] [proxy_fcgi:error] [pid 988:tid 140517548611136] [client 127.0.0.1:53708] AH01071: Got error 'PHP message: wcs_renewal_order_meta_query is deprecated since version subscriptions-core 2.5.0! Use wc_subscriptions_renewal_order_data instead.PHP message: wcs_renewal_order_meta is deprecated since version wcs-core 2.5.0! Use wc_subscriptions_renewal_order_data instead.', referer: https://bolognaforsale.com/wp-admin/admin-ajax.php?action=as_async_request_queue_runner&nonce=0398068

    It looks like all you would have to do is replace the current deprecated filter usage with:

    // Replace the deprecated filter usage in initialize() with this:
    add_filter( 'wc_subscriptions_renewal_order_data', [ $this, 'remove_renewal_order_meta' ], 10 );
    
    // Replace your subscriptions_remove_renewal_order_meta method with:
    public function remove_renewal_order_meta( $order_meta ) {
    	unset( $order_meta['_order_number'] );
    	return $order_meta;
    }
    
    • This reply was modified 1 year, 10 months ago by skunkbad. Reason: Gave you the solution to the problem
    • This reply was modified 1 year, 10 months ago by skunkbad.
    • This reply was modified 1 year, 10 months ago by skunkbad.
    • This reply was modified 1 year, 10 months ago by skunkbad.
    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @bverhoeven @skunkbad,

    Thanks for sharing the information. We will address it in our upcoming release. Thanks for understanding.

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @bverhoeven @skunkbad,

    Greetings from WebToffee!

    We have addressed the issue in the latest version of our plugin. Kindly update the plugin to the latest version (v1.5.0) and check.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Deprecated subscription hooks prevent subscription renewal’ is closed to new replies.