woocommerce / woocommerce-square

Square POS and Payments Integration
https://woo.com/products/square
Other
11 stars 7 forks source link

The 'wcs_renewal_order_meta' filter is deprecated #179

Closed james-allan closed 3 months ago

james-allan commented 4 months ago

Describe the bug

Stores with Square and Subscriptions running currently get the following deprecated notice:

PHP Deprecated:  Hook wcs_renewal_order_meta is deprecated since version wcs-core 2.5.0! Use wc_subscriptions_renewal_order_data instead. in /public/wp-includes/functions.php on line 6078

From my search, Square still uses the wcs_renewal_order_meta hook here: https://github.com/woocommerce/woocommerce-square/blob/414e4126291bd85efdbae37c34890cd574491a6c/includes/Framework/PaymentGateway/Integrations/Payment_Gateway_Integration_Subscriptions.php#L96

We should update this hook to the new one wc_subscriptions_renewal_order_data. There will need to be minor changes as the form of the passed data is slightly different.

To reproduce

  1. Install and enable WooCommerce Subscriptions
  2. Create a subscription product"
    • Products > Add new.
    • Select "Simple Subscription".
    • Enter a price.
    • Save.
  3. Purchase the subscription using Square.
  4. On the admin dashboard go to WooCommerce > Subscriptions.
  5. From the actions drop down select "Process renewal".

Screenshot 2024-07-17 at 2 50 11 PM

  1. Save the subscription to run the action.
  2. Check your error logs, you should see the following notice:
PHP Deprecated:  Hook wcs_renewal_order_meta is <strong>deprecated</strong> since version wcs-core 2.5.0! Use wc_subscriptions_renewal_order_data instead. in /app/public/wp-includes/functions.php on line 6085