From b2a4dd8022af0b0349f1a20817ebd5de2b628852 Mon Sep 17 00:00:00 2001 From: WooCommerce Date: Tue, 16 Jul 2024 10:11:59 +0000 Subject: [PATCH] Updates to 6.5.0 --- changelog.txt | 8 + ...class-wc-rest-subscriptions-controller.php | 23 ++- ...lass-wc-subscriptions-payment-gateways.php | 8 +- languages/woocommerce-subscriptions.pot | 162 ++++++++++-------- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 8 +- vendor/composer/autoload_static.php | 8 +- vendor/composer/installed.json | 14 +- vendor/composer/installed.php | 18 +- .../subscriptions-core/changelog.txt | 5 + .../views/html-related-orders-row.php | 3 +- ...c-subscriptions-change-payment-gateway.php | 5 + .../class-wc-subscriptions-core-plugin.php | 2 +- .../class-wc-subscriptions-renewal-order.php | 3 +- .../includes/wcs-renewal-functions.php | 45 ++++- .../templates/myaccount/my-subscriptions.php | 3 +- .../templates/myaccount/related-orders.php | 5 +- .../myaccount/related-subscriptions.php | 5 +- .../woocommerce-subscriptions-core.php | 2 +- woocommerce-subscriptions.php | 6 +- 20 files changed, 222 insertions(+), 113 deletions(-) diff --git a/changelog.txt b/changelog.txt index 153a4e5..0c14dbb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,13 @@ *** WooCommerce Subscriptions Changelog *** +2024-07-16 - version 6.5.0 +* Add: Include trial_period, suspension_count, and requires_manual_renewal in the REST API response for subscriptions. +* Update: When a renewal order's payment is skipped, include the order's current status in the note to help troubleshooting. +* Fix: Label improvements on subscription and order page templates. +* Fix: Fixed an issue with subscriptions containing multiple renewal orders to mark a random item as processing, instead of the last order. +* Fix: Prevent errors from invalid subscription objects during customer payment method updates. +* Dev: Updated subscriptions-core to 7.3.0. + 2024-06-28 - version 6.4.1 * Fix: Resolved errors preventing subscription-related webhooks from sending on WC 9.0 stores. diff --git a/includes/api/class-wc-rest-subscriptions-controller.php b/includes/api/class-wc-rest-subscriptions-controller.php index ccafd6f..5eaf9e4 100644 --- a/includes/api/class-wc-rest-subscriptions-controller.php +++ b/includes/api/class-wc-rest-subscriptions-controller.php @@ -107,8 +107,11 @@ public function prepare_object_for_response( $object, $request ) { } // Add subscription specific data to the base order response data. - $response->data['billing_period'] = $object->get_billing_period(); - $response->data['billing_interval'] = $object->get_billing_interval(); + $response->data['billing_period'] = $object->get_billing_period(); + $response->data['billing_interval'] = $object->get_billing_interval(); + $response->data['trial_period'] = $object->get_trial_period(); + $response->data['suspension_count'] = $object->get_suspension_count(); + $response->data['requires_manual_renewal'] = $object->get_requires_manual_renewal(); foreach ( wcs_get_subscription_date_types() as $date_type => $date_name ) { $date = $object->get_date( wcs_normalise_date_type_key( $date_type ) ); @@ -396,6 +399,22 @@ public function get_item_schema() { 'enum' => array_keys( wcs_get_subscription_period_strings() ), 'context' => array( 'view', 'edit' ), ), + 'trial_period' => array( + 'description' => __( 'Trial period for the subscription.', 'woocommerce-subscriptions' ), + 'type' => 'string', + 'enum' => array_keys( wcs_get_subscription_period_strings() ), + 'context' => array( 'view', 'edit' ), + ), + 'suspension_count' => array( + 'description' => __( 'The number of times the subscription has been suspended since the last payment.', 'woocommerce-subscriptions' ), + 'type' => 'integer', + 'context' => array( 'view', 'edit' ), + ), + 'requires_manual_renewal' => array( + 'description' => __( 'Whether the subscription requires manual renewal.', 'woocommerce-subscriptions' ), + 'type' => 'boolean', + 'context' => array( 'view', 'edit' ), + ), 'payment_details' => array( 'description' => __( 'Subscription payment details.', 'woocommerce-subscriptions' ), 'type' => 'object', diff --git a/includes/gateways/class-wc-subscriptions-payment-gateways.php b/includes/gateways/class-wc-subscriptions-payment-gateways.php index cfef7bb..252065d 100644 --- a/includes/gateways/class-wc-subscriptions-payment-gateways.php +++ b/includes/gateways/class-wc-subscriptions-payment-gateways.php @@ -86,6 +86,7 @@ public static function gateway_scheduled_subscription_payment( $subscription_id, $latest_renewal_order = $subscription->get_last_order( 'all', 'renewal' ); if ( empty( $latest_renewal_order ) ) { + $subscription->add_order_note( __( "Renewal order payment processing was skipped because we couldn't locate the latest renewal order.", 'woocommerce_subscriptions' ) ); return; } @@ -94,9 +95,10 @@ public static function gateway_scheduled_subscription_payment( $subscription_id, } elseif ( $latest_renewal_order->get_total() > 0 ) { $subscription->add_order_note( sprintf( - /* Translators: placeholder is a subscription renewal order ID as a link */ - __( 'Payment processing of the renewal order %s was skipped because it is already paid.', 'woocommerce_subscriptions' ), - '' . _x( '#', 'hash before order number', 'woocommerce' ) . $latest_renewal_order->get_order_number() . '' + /* Translators: 1: placeholder is a subscription renewal order ID as a link, 2: placeholder the order's current status */ + __( 'Payment processing of the renewal order %1$s was skipped because it is already paid (%2$s).', 'woocommerce_subscriptions' ), + '' . _x( '#', 'hash before order number', 'woocommerce' ) . $latest_renewal_order->get_order_number() . '', + wc_get_order_status_name( $latest_renewal_order->get_status() ) ) ); } diff --git a/languages/woocommerce-subscriptions.pot b/languages/woocommerce-subscriptions.pot index fa4ecd1..3e35263 100644 --- a/languages/woocommerce-subscriptions.pot +++ b/languages/woocommerce-subscriptions.pot @@ -2,14 +2,14 @@ # This file is distributed under the same license as the WooCommerce Subscriptions plugin. msgid "" msgstr "" -"Project-Id-Version: WooCommerce Subscriptions 6.4.1\n" +"Project-Id-Version: WooCommerce Subscriptions 6.5.0\n" "Report-Msgid-Bugs-To: https://woocommerce.com/contact-us\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2024-06-28T01:10:56+00:00\n" +"POT-Creation-Date: 2024-07-16T06:24:54+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.9.0\n" "X-Domain: woocommerce-subscriptions\n" @@ -467,7 +467,7 @@ msgstr "" #: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:216 #: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-table.php:20 #: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:23 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:47 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:48 msgid "Date" msgstr "" @@ -672,67 +672,67 @@ msgstr "" msgid "Payment Gateway Feature Support." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:165 +#: includes/api/class-wc-rest-subscriptions-controller.php:168 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:164 msgid "Invalid subscription ID." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:171 +#: includes/api/class-wc-rest-subscriptions-controller.php:174 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:170 msgid "Failed to load subscription object with the ID %d." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:328 +#: includes/api/class-wc-rest-subscriptions-controller.php:331 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:329 msgid "Subscription dates could not be set. Error message: %s" msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:364 +#: includes/api/class-wc-rest-subscriptions-controller.php:367 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:371 msgid "Subscription status." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:367 +#: includes/api/class-wc-rest-subscriptions-controller.php:370 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:374 msgid "Where the subscription was created." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:368 +#: includes/api/class-wc-rest-subscriptions-controller.php:371 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:375 msgid "Currency the subscription was created with, in ISO format." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:369 +#: includes/api/class-wc-rest-subscriptions-controller.php:372 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:376 msgid "The date the subscription was created, in the site's timezone." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:370 +#: includes/api/class-wc-rest-subscriptions-controller.php:373 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:377 msgid "The date the subscription was created, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:371 +#: includes/api/class-wc-rest-subscriptions-controller.php:374 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:378 msgid "The date the subscription was last modified, in the site's timezone." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:372 +#: includes/api/class-wc-rest-subscriptions-controller.php:375 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:379 msgid "The date the subscription was last modified, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:373 +#: includes/api/class-wc-rest-subscriptions-controller.php:376 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:380 msgid "User ID who owns the subscription." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:383 +#: includes/api/class-wc-rest-subscriptions-controller.php:386 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:390 msgid "The status to transition a subscription to." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:389 +#: includes/api/class-wc-rest-subscriptions-controller.php:392 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:350 #: includes/api/v1/class-wc-rest-subscriptions-v1-controller.php:506 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:396 @@ -741,7 +741,7 @@ msgstr "" msgid "The number of billing periods between subscription renewals." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:394 +#: includes/api/class-wc-rest-subscriptions-controller.php:397 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:355 #: includes/api/v1/class-wc-rest-subscriptions-v1-controller.php:511 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:401 @@ -750,83 +750,95 @@ msgstr "" msgid "Billing period for the subscription." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:400 +#: includes/api/class-wc-rest-subscriptions-controller.php:403 +msgid "Trial period for the subscription." +msgstr "" + +#: includes/api/class-wc-rest-subscriptions-controller.php:409 +msgid "The number of times the subscription has been suspended since the last payment." +msgstr "" + +#: includes/api/class-wc-rest-subscriptions-controller.php:414 +msgid "Whether the subscription requires manual renewal." +msgstr "" + +#: includes/api/class-wc-rest-subscriptions-controller.php:419 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:361 #: includes/api/v1/class-wc-rest-subscriptions-v1-controller.php:517 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:407 msgid "Subscription payment details." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:405 +#: includes/api/class-wc-rest-subscriptions-controller.php:424 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:412 msgid "Payment method meta and token in a post_meta_key: token format." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:410 +#: includes/api/class-wc-rest-subscriptions-controller.php:429 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:417 msgid "Payment method meta and token in a user_meta_key : token format." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:417 +#: includes/api/class-wc-rest-subscriptions-controller.php:436 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:424 msgid "The subscription's start date, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:422 +#: includes/api/class-wc-rest-subscriptions-controller.php:441 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:429 msgid "The subscription's trial end date, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:427 +#: includes/api/class-wc-rest-subscriptions-controller.php:446 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:434 msgid "The subscription's next payment date, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:432 +#: includes/api/class-wc-rest-subscriptions-controller.php:451 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:439 msgid "The subscription's cancelled date, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:437 +#: includes/api/class-wc-rest-subscriptions-controller.php:456 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:444 msgid "The subscription's end date, as GMT." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:456 +#: includes/api/class-wc-rest-subscriptions-controller.php:475 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:464 msgid "Limit result set to subscriptions which have specific statuses." msgstr "" #. translators: placeholder is the payment method ID. -#: includes/api/class-wc-rest-subscriptions-controller.php:500 +#: includes/api/class-wc-rest-subscriptions-controller.php:519 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:511 msgid "The %s payment gateway does not support admin changing the payment method." msgstr "" #. translators: 1$: gateway id, 2$: error message -#: includes/api/class-wc-rest-subscriptions-controller.php:517 +#: includes/api/class-wc-rest-subscriptions-controller.php:536 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:336 #: includes/api/v1/class-wc-rest-subscriptions-v1-controller.php:405 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:528 msgid "Subscription payment method could not be set to %1$s with error message: %2$s" msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:531 +#: includes/api/class-wc-rest-subscriptions-controller.php:550 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:545 msgid "Invalid order ID." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:537 +#: includes/api/class-wc-rest-subscriptions-controller.php:556 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:551 msgid "Failed to load order object with the ID %d." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:541 +#: includes/api/class-wc-rest-subscriptions-controller.php:560 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:555 msgid "Order does not have a customer associated with it. Subscriptions require a customer." msgstr "" -#: includes/api/class-wc-rest-subscriptions-controller.php:545 +#: includes/api/class-wc-rest-subscriptions-controller.php:564 #: includes/api/v2/class-wc-rest-subscriptions-v2-controller.php:559 msgid "Order already has subscriptions associated with it." msgstr "" @@ -1323,12 +1335,12 @@ msgstr "" #. translators: %s: order number. #: includes/early-renewal/class-wcs-cart-early-renewal.php:222 #: includes/early-renewal/wcs-early-renewal-functions.php:136 -#: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-row.php:17 +#: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-row.php:18 #: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-unknown-related-orders-row.php:18 -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php:170 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:35 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:44 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:33 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php:171 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:36 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:45 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:34 msgctxt "hash before order number" msgid "#%s" msgstr "" @@ -1425,7 +1437,7 @@ msgid "Subscription doesn't exist in scheduled action: %d" msgstr "" #. translators: $1-$2: opening and closing tags. Link to documents->payment gateways, 3$-4$: opening and closing tags. Link to WooCommerce extensions shop page -#: includes/gateways/class-wc-subscriptions-payment-gateways.php:150 +#: includes/gateways/class-wc-subscriptions-payment-gateways.php:152 msgid "Find new gateways that %1$ssupport automatic subscription payments%2$s in the official %3$sWooCommerce Marketplace%4$s." msgstr "" @@ -1549,7 +1561,7 @@ msgid "Y/m/d g:i:s A" msgstr "" #: includes/payment-retry/admin/html-retries-table.php:47 -#: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-row.php:32 +#: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-row.php:33 msgid "Unpublished" msgstr "" @@ -2406,7 +2418,7 @@ msgstr "" #: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-post-types.php:1774 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-manager.php:1955 #: vendor/woocommerce/subscriptions-core/includes/wcs-user-functions.php:329 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:78 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:79 msgctxt "an action on a subscription" msgid "Cancel" msgstr "" @@ -2428,11 +2440,11 @@ msgstr[1] "" #: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-post-types.php:468 #: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-table.php:21 #: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:22 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:39 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:40 #: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:24 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:50 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:51 #: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:22 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:36 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:37 #: vendor/woocommerce/subscriptions-core/templates/myaccount/subscription-details.php:18 msgid "Status" msgstr "" @@ -2906,6 +2918,11 @@ msgstr "" msgid "Error updating some information: %s" msgstr "" +#. translators: placeholder is an order number. +#: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-row.php:15 +msgid "Edit order number %s" +msgstr "" + #: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-table.php:18 #: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:42 msgid "Order Number" @@ -3105,7 +3122,7 @@ msgstr "" #. translators: %s: order number. #. translators: placeholder is a subscription ID. #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-addresses.php:242 -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:751 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:756 #: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:101 msgctxt "hash before order number" msgid "Subscription #%s" @@ -3294,30 +3311,30 @@ msgid "Payment method updated for all your current subscriptions." msgstr "" #. translators: 1: old payment title, 2: new payment title. -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:529 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:534 msgctxt "%1$s: old payment title, %2$s: new payment title" msgid "Payment method changed from \"%1$s\" to \"%2$s\" by the subscriber." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:540 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:545 msgid "An error occurred updating your subscription's payment method. Please contact us for assistance." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:548 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:553 msgid "%1$sError:%2$s %3$s" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:773 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:778 msgctxt "the page title of the change payment method form" msgid "Change payment method" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:775 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:780 msgctxt "the page title of the add payment method form" msgid "Add payment method" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:817 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:822 msgid "Please log in to your account below to choose a new payment method for your subscription." msgstr "" @@ -4016,11 +4033,11 @@ msgid "This variation can not be removed because it is associated with existing msgstr "" #. translators: placeholder is order ID -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php:173 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php:174 msgid "Order %s created to record renewal." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php:193 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php:194 msgid "Subscription renewal orders cannot be cancelled." msgstr "" @@ -6687,7 +6704,7 @@ msgstr[1] "" #: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:23 #: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:23 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:39 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:40 msgctxt "table heading" msgid "Next payment" msgstr "" @@ -6697,43 +6714,49 @@ msgstr "" msgid "ID" msgstr "" -#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:42 +#. translators: placeholder is a subscription number. +#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:35 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:33 +msgid "View subscription number %s" +msgstr "" + +#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:43 #: vendor/woocommerce/subscriptions-core/wcs-functions.php:292 msgctxt "table heading" msgid "Next Payment" msgstr "" -#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:48 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:53 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:42 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:49 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:54 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:43 msgctxt "Used in data attribute. Escaped" msgid "Total" msgstr "" -#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:52 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:84 -#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:46 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:53 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:85 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:47 msgctxt "view a subscription" msgid "View" msgstr "" -#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:63 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:64 msgid "Previous" msgstr "" -#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:67 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:68 msgid "Next" msgstr "" -#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:74 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:75 msgid "You have reached the end of subscriptions. Go to the %sfirst page%s." msgstr "" -#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:76 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:77 msgid "You have no active subscriptions." msgstr "" -#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:79 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:80 msgid "Browse products" msgstr "" @@ -6745,14 +6768,19 @@ msgstr "" msgid "Order" msgstr "" +#. translators: placeholder is an order number. +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:44 +msgid "View order number %s" +msgstr "" + #. translators: $1: formatted order total for the order, $2: number of items bought -#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:56 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:57 msgid "%1$s for %2$d item" msgid_plural "%1$s for %2$d items" msgstr[0] "" msgstr[1] "" -#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:65 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:66 msgctxt "pay for a subscription" msgid "Pay" msgstr "" diff --git a/vendor/autoload.php b/vendor/autoload.php index 92f4bda..7fed99b 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitb6faa2b65c1d08bc372be5e5be1acee6::getLoader(); +return ComposerAutoloaderInit8810e821b269df6dcc857459761afe4a::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index bda99fa..e329fde 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitb6faa2b65c1d08bc372be5e5be1acee6 +class ComposerAutoloaderInit8810e821b269df6dcc857459761afe4a { private static $loader; @@ -24,12 +24,12 @@ public static function getLoader() require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInitb6faa2b65c1d08bc372be5e5be1acee6', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit8810e821b269df6dcc857459761afe4a', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInitb6faa2b65c1d08bc372be5e5be1acee6', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit8810e821b269df6dcc857459761afe4a', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitb6faa2b65c1d08bc372be5e5be1acee6::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit8810e821b269df6dcc857459761afe4a::getInitializer($loader)); $loader->register(true); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 4d77762..9f7752f 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitb6faa2b65c1d08bc372be5e5be1acee6 +class ComposerStaticInit8810e821b269df6dcc857459761afe4a { public static $prefixLengthsPsr4 = array ( 'C' => @@ -129,9 +129,9 @@ class ComposerStaticInitb6faa2b65c1d08bc372be5e5be1acee6 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitb6faa2b65c1d08bc372be5e5be1acee6::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitb6faa2b65c1d08bc372be5e5be1acee6::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitb6faa2b65c1d08bc372be5e5be1acee6::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit8810e821b269df6dcc857459761afe4a::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit8810e821b269df6dcc857459761afe4a::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit8810e821b269df6dcc857459761afe4a::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 08d12b3..c571e70 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -156,17 +156,17 @@ }, { "name": "woocommerce/subscriptions-core", - "version": "7.2.0", - "version_normalized": "7.2.0.0", + "version": "7.3.0", + "version_normalized": "7.3.0.0", "source": { "type": "git", "url": "https://github.com/Automattic/woocommerce-subscriptions-core.git", - "reference": "9f42efee04a8e8966c2fda22c25ee1793fe9839e" + "reference": "f144df5b7ee103c4e792d8ddc0e72f1839def8b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/9f42efee04a8e8966c2fda22c25ee1793fe9839e", - "reference": "9f42efee04a8e8966c2fda22c25ee1793fe9839e", + "url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/f144df5b7ee103c4e792d8ddc0e72f1839def8b2", + "reference": "f144df5b7ee103c4e792d8ddc0e72f1839def8b2", "shasum": "" }, "require": { @@ -179,7 +179,7 @@ "woocommerce/woocommerce-sniffs": "0.1.0", "yoast/phpunit-polyfills": "1.1.0" }, - "time": "2024-06-13T01:14:44+00:00", + "time": "2024-07-16T05:33:10+00:00", "type": "wordpress-plugin", "extra": { "phpcodesniffer-search-depth": 2 @@ -209,7 +209,7 @@ "description": "Sell products and services with recurring payments in your WooCommerce Store.", "homepage": "https://github.com/Automattic/woocommerce-subscriptions-core", "support": { - "source": "https://github.com/Automattic/woocommerce-subscriptions-core/tree/7.2.0", + "source": "https://github.com/Automattic/woocommerce-subscriptions-core/tree/7.3.0", "issues": "https://github.com/Automattic/woocommerce-subscriptions-core/issues" }, "install-path": "../woocommerce/subscriptions-core" diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 4bef9df..ad0ebb0 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => 'woocommerce/woocommerce-subscriptions', - 'pretty_version' => 'dev-release/6.4.1', - 'version' => 'dev-release/6.4.1', - 'reference' => '1731999c38ad73e9593177e016f02aa815ed4dca', + 'pretty_version' => 'dev-release/6.5.0', + 'version' => 'dev-release/6.5.0', + 'reference' => '75ec0cbc31ee105f66684b10fb0433b44b3e58e9', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -32,18 +32,18 @@ ), ), 'woocommerce/subscriptions-core' => array( - 'pretty_version' => '7.2.0', - 'version' => '7.2.0.0', - 'reference' => '9f42efee04a8e8966c2fda22c25ee1793fe9839e', + 'pretty_version' => '7.3.0', + 'version' => '7.3.0.0', + 'reference' => 'f144df5b7ee103c4e792d8ddc0e72f1839def8b2', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../woocommerce/subscriptions-core', 'aliases' => array(), 'dev_requirement' => false, ), 'woocommerce/woocommerce-subscriptions' => array( - 'pretty_version' => 'dev-release/6.4.1', - 'version' => 'dev-release/6.4.1', - 'reference' => '1731999c38ad73e9593177e016f02aa815ed4dca', + 'pretty_version' => 'dev-release/6.5.0', + 'version' => 'dev-release/6.5.0', + 'reference' => '75ec0cbc31ee105f66684b10fb0433b44b3e58e9', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/vendor/woocommerce/subscriptions-core/changelog.txt b/vendor/woocommerce/subscriptions-core/changelog.txt index 73a42a9..fe250ee 100644 --- a/vendor/woocommerce/subscriptions-core/changelog.txt +++ b/vendor/woocommerce/subscriptions-core/changelog.txt @@ -1,5 +1,10 @@ *** WooCommerce Subscriptions Core Changelog *** += 7.3.0 - 2024-07-16 = +* Fix - Label improvements on subscription and order page templates. +* Fix - Fixed an issue with subscriptions containing multiple renewal orders to mark a random item as processing, instead of the last order. +* Fix - Prevent errors from invalid subscription objects during customer payment method updates. + = 7.2.0 - 2024-06-13 = * Fix - label improvement on my subscription page template. * Fix - Regenerate subscriptions related order caches (renewal, resubscribe, switch) if it's stored as an invalid value to prevent fatal errors. diff --git a/vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-row.php b/vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-row.php index 2efd585..95ee80c 100644 --- a/vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-row.php +++ b/vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-row.php @@ -11,7 +11,8 @@ ?> - + + get_order_number() ) ); diff --git a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php index 28e6842..6a49f99 100644 --- a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php +++ b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php @@ -419,6 +419,11 @@ public static function update_all_payment_methods_from_subscription( $subscripti } $user_subscription = wcs_get_subscription( $subscription_id ); + + if ( ! $user_subscription instanceof WC_Subscription ) { + continue; + } + // Skip if subscription's current payment method is not supported if ( ! $user_subscription->payment_method_supports( 'subscription_cancellation' ) ) { continue; diff --git a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php index 936d82d..5df8f07 100644 --- a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php +++ b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php @@ -16,7 +16,7 @@ class WC_Subscriptions_Core_Plugin { * The version of subscriptions-core library. * @var string */ - protected $library_version = '7.2.0'; // WRCS: DEFINED_VERSION. + protected $library_version = '7.3.0'; // WRCS: DEFINED_VERSION. /** * The subscription scheduler instance. diff --git a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php index d9c73a5..127fa52 100644 --- a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php +++ b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php @@ -130,7 +130,8 @@ public static function maybe_record_subscription_payment( $order_id, $orders_old $is_failed_renewal_order = 'failed' === $orders_old_status || wc_string_to_bool( $order->get_meta( WC_Subscription::RENEWAL_FAILED_META_KEY, true ) ); $is_failed_renewal_order = apply_filters( 'woocommerce_subscriptions_is_failed_renewal_order', $is_failed_renewal_order, $order_id, $orders_old_status ); - if ( $order_needed_payment ) { + // Subscription will be activated only if this is the last renewal order of the subscription. + if ( $order_needed_payment && wcs_is_order_last_renewal_of_subscription( $order, $subscription ) ) { $subscription->payment_complete(); $was_activated = true; } diff --git a/vendor/woocommerce/subscriptions-core/includes/wcs-renewal-functions.php b/vendor/woocommerce/subscriptions-core/includes/wcs-renewal-functions.php index 057f995..1babc62 100644 --- a/vendor/woocommerce/subscriptions-core/includes/wcs-renewal-functions.php +++ b/vendor/woocommerce/subscriptions-core/includes/wcs-renewal-functions.php @@ -62,6 +62,18 @@ function wcs_order_contains_renewal( $order ) { return apply_filters( 'woocommerce_subscriptions_is_renewal_order', $is_renewal, $order ); } +/** + * Determines if a given order is the subscription's latest renewal order. + * + * @param $order WC_Order The order object. + * @param $subscription WC_Subscription The subscription object. + * @return bool Whether the order is the latest renewal order of the provided subscription. + */ +function wcs_is_order_last_renewal_of_subscription( $order, $subscription ) { + $last_renewal_order = wcs_get_last_renewal_order( $subscription ); + return $last_renewal_order && $last_renewal_order->get_id() === $order->get_id(); +} + /** * Checks the cart to see if it contains a subscription product renewal. * @@ -128,10 +140,7 @@ function wcs_get_subscriptions_for_renewal_order( $order ) { */ function wcs_get_last_non_early_renewal_order( $subscription ) { $last_non_early_renewal = false; - $renewal_orders = $subscription->get_related_orders( 'all', 'renewal' ); - - // We need the orders sorted by the date they were created, with the newest first. - wcs_sort_objects( $renewal_orders, 'date_created', 'descending' ); + $renewal_orders = wcs_get_renewal_orders_sorted_by( $subscription, 'date_created' ); foreach ( $renewal_orders as $renewal_order ) { if ( ! wcs_order_contains_early_renewal( $renewal_order ) ) { @@ -143,6 +152,34 @@ function wcs_get_last_non_early_renewal_order( $subscription ) { return $last_non_early_renewal; } +/** + * Get the last renewal order (early renewals included). + * + * @param WC_Subscription $subscription The subscription object. + * @return WC_Order|bool The last non-early renewal order, otherwise false. + */ +function wcs_get_last_renewal_order( $subscription ) { + $renewal_orders = wcs_get_renewal_orders_sorted_by( $subscription, 'date_created' ); + return $renewal_orders ? reset( $renewal_orders ) : false; +} + +/** + * Gets the renewal orders for a subscription, sorted by the specified property. + * + * @param WC_Subscription $subscription The subscription object. + * @param string $sort_by The subscription property to sort by. + * @param string $order Optional. The sort order to sort by. Default is 'descending'. + * + * @return WC_Order[] The subscriptions renewal orders sorted. + */ +function wcs_get_renewal_orders_sorted_by( $subscription, $sort_by, $order = 'descending' ) { + $renewal_orders = $subscription->get_related_orders( 'all', 'renewal' ); + + wcs_sort_objects( $renewal_orders, $sort_by, $order ); + + return $renewal_orders; +} + /** * Checks if manual renewals are required - automatic renewals are disabled. * diff --git a/vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php b/vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php index 4864b4f..017f8d9 100644 --- a/vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php +++ b/vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php @@ -31,7 +31,8 @@ $subscription ) : ?> - + + get_order_number() ) ); ?> diff --git a/vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php b/vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php index 9b264a7..b004eec 100644 --- a/vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php +++ b/vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php @@ -4,7 +4,7 @@ * * @author Prospress * @category WooCommerce Subscriptions/Templates - * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.2 + * @version 7.3.0 - Migrated from WooCommerce Subscriptions v2.6.2 */ if ( ! defined( 'ABSPATH' ) ) { @@ -40,7 +40,8 @@ ?> - + + get_order_number() ) ); ?> diff --git a/vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php b/vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php index 69b02dd..5a2156b 100644 --- a/vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php +++ b/vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php @@ -4,7 +4,7 @@ * * @author Prospress * @category WooCommerce Subscriptions/Templates - * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.6.0 + * @version 7.3.0 - Migrated from WooCommerce Subscriptions v2.6.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -29,7 +29,8 @@ $subscription ) : ?> - + + get_order_number() ) ); ?> diff --git a/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php b/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php index 569549b..c3771f1 100644 --- a/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php +++ b/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php @@ -6,5 +6,5 @@ * Author: Automattic * Author URI: https://woocommerce.com/ * Requires WP: 5.6 - * Version: 7.2.0 + * Version: 7.3.0 */ diff --git a/woocommerce-subscriptions.php b/woocommerce-subscriptions.php index 4d81ce2..3044d86 100644 --- a/woocommerce-subscriptions.php +++ b/woocommerce-subscriptions.php @@ -5,11 +5,11 @@ * Description: Sell products and services with recurring payments in your WooCommerce Store. * Author: WooCommerce * Author URI: https://woocommerce.com/ - * Version: 6.4.1 + * Version: 6.5.0 * Requires Plugins: woocommerce * * WC requires at least: 8.7.1 - * WC tested up to: 9.0.0 + * WC tested up to: 9.1.0 * Woo: 27147:6115e6d7e297b623a169fdcf5728b224 * * Copyright 2019 WooCommerce @@ -78,7 +78,7 @@ class WC_Subscriptions { public static $plugin_file = __FILE__; /** @var string */ - public static $version = '6.4.1'; // WRCS: DEFINED_VERSION. + public static $version = '6.5.0'; // WRCS: DEFINED_VERSION. /** @var string */ public static $wc_minimum_supported_version = '7.7';