godaddy-wordpress / wc-plugin-framework

The official SkyVerge WooCommerce plugin framework
Other
138 stars 42 forks source link

Replace deprecated `wcs_renewal_order_meta` filter usage with `wc_subscriptions_renewal_order_data` #642

Closed unfulvio-godaddy closed 7 months ago

unfulvio-godaddy commented 8 months ago

Closes #640

The filters should be compatible. We can probably roll this out contextually to #641 which this PR bases itseful upon.

I have found filter declared in Subscriptions WC_Subscriptions_Data_Copier:125-144 (see class-wc-subscriptions-data-copier.php) -- declared as follows

        /**
         * Filters the data to be copied from one object to another.
         *
         * This filter name contains a dynamic part, $this->copy_type. The full set of hooks include:
         *     - wc_subscriptions_subscription_data
         *     - wc_subscriptions_parent_data
         *     - wc_subscriptions_renewal_order_data
         *     - wc_subscriptions_resubscribe_order_data
         *
         * @since subscriptions-core 2.5.0
         *
         * @param array    $data {
         *     The data to be copied to the "to" object. Each value is keyed by the meta key. Example format [ '_meta_key' => 'meta_value' ].
         *
         *     @type mixed $meta_value The meta value to be copied.
         * }
         * @param WC_Order $from_object The object to copy data from.
         * @param WC_Order $to_object   The object to copy data to.
         */
        $data = apply_filters( "wc_subscriptions_{$this->copy_type}_data", $data, $this->to_object, $this->from_object );