• Resolved Louis

    (@louisgan)


    Debug log:

    wcs_subscription_meta_query is deprecated since version subscriptions-core 2.5.0! Use wc_subscriptions_subscription_data instead.

    Code:

    Wf_Woocommerce_Packing_List_Invoice::__construct();

    /**

             * WC Subscriptions Support

            * The subscription plugin copies all meta data from the parent order during renewal order

            * creation.

            * To prevent invoice number duplication, the copying of the invoice number should be avoided.

            *

            * @since 4.7.6

            */

            if ( in_array( 'woocommerce-subscriptions/woocommerce-subscriptions.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) || class_exists( 'WC_Subscriptions' ) ) {

                $subscription_version = class_exists( 'WC_Subscriptions' ) && ! empty( WC_Subscriptions::$version ) ? WC_Subscriptions::$version : null;

                // Prevent data being copied to subscriptions

                if ( null !== $subscription_version && version_compare( $subscription_version, '2.5.0', '>=' ) ) {

                    add_filter( 'wc_subscriptions_subscription_data', array( $this, 'remove_invoice_number_from_renewal_order_meta' ) );

                    add_filter( 'wc_subscriptions_renewal_order_data', array( $this, 'remove_invoice_number_from_renewal_order_meta') );

                } else {

                    add_filter( 'wcs_subscription_meta_query', array( $this, 'subscriptions_remove_renewal_invoice_number_meta' ) );

                    add_filter( 'wcs_renewal_order_meta_query', array( $this, 'subscriptions_remove_renewal_invoice_number_meta' ), 10 );

                }

            }

    Issue:

    $subscription_version = class_exists( 'WC_Subscriptions' ) && ! empty( WC_Subscriptions::$version ) ? WC_Subscriptions::$version : null;

    This code is called before WC_Subscriptions class has the chance to load hence $subscription_version will always be null.

    Solution:

    Move this code section to plugin_loaded action hook where all plugins would have been loaded and you also no longer need the following check condition since WC_Subscriptions class would already be loaded and can be check alone with class_exists method.

    in_array( 'woocommerce-subscriptions/woocommerce-subscriptions.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true )

    Thanks

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

    (@webtoffeesupport)

    Hi @louisgan,

    Thank you for bringing it to our attention!

    We have noted the changes mentioned and will include them in the upcoming version of the plugin.

    Plugin Support WebToffee Support

    (@webtoffeesupport)

    Hi @louisgan,

    We’ve released an update with the fix you suggested, and it’s now live. Please check and let us know if you encounter any issues. Thanks again for bringing this to our attention!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘wcs_subscription_meta_query is deprecated since version subscriptions-core 2.5.0’ is closed to new replies.