diff --git a/changelog.txt b/changelog.txt index 81ca0dd..1c1e655 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ *** WooCommerce Subscriptions Changelog *** +2024-09-05 - version 6.6.2 +* Fix: Prevent errors during checkout when a customer is switching their subscription product and does not require payment. +* Dev: Update subscriptions-core to 7.4.3. + 2024-08-27 - version 6.6.1 * Fix: Resolved an issue where simple product prices were incorrectly set to $0 when purchasing subscriptions and simple products with a coupon in WC 9.2. * Dev: Update subscriptions-core to 7.4.2. diff --git a/includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php b/includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php index 6aace94..ccd3540 100644 --- a/includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php +++ b/includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php @@ -48,6 +48,10 @@ class WCS_Report_Upcoming_Recurring_Revenue extends WC_Admin_Report { $scheduled_ends[ $key ] = date( 'Y-m-d', strtotime( $scheduled_ends[ $key ] ) ); } + if ( ! isset( $billing_intervals[ $key ] ) || ! isset( $billing_periods[ $key ] ) || ! in_array( $billing_periods[ $key ], array_keys( wcs_get_subscription_period_strings() ), true ) ) { + continue; + } + // Keep calculating all the new payments until we hit the end date of the search do { @@ -69,7 +73,9 @@ class WCS_Report_Upcoming_Recurring_Revenue extends WC_Admin_Report { $this->order_ids_recurring_totals[ $update_key ]->recurring_total += $subscription_totals[ $key ]; } } - } while ( $next_payment_timestamp <= $this->end_date && isset( $scheduled_ends[ $key ] ) && ( 0 == $scheduled_ends[ $key ] || $next_payment_timestamp < strtotime( $scheduled_ends[ $key ] ) ) ); + } while ( $next_payment_timestamp > 0 && $next_payment_timestamp <= $this->end_date + && isset( $key, $scheduled_ends[ $key ] ) + && ( 0 == $scheduled_ends[ $key ] || $next_payment_timestamp < strtotime( $scheduled_ends[ $key ] ) ) ); } } diff --git a/languages/woocommerce-subscriptions.pot b/languages/woocommerce-subscriptions.pot index c07bd6a..dc0a0ca 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.6.1\n" +"Project-Id-Version: WooCommerce Subscriptions 6.6.2\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-08-27T01:02:31+00:00\n" +"POT-Creation-Date: 2024-09-05T03:31:47+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" @@ -464,7 +464,7 @@ msgstr "" #: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:781 #: includes/admin/reports/class-wcs-report-subscription-payment-retry.php:195 -#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:216 +#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:222 #: 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:48 @@ -473,7 +473,7 @@ msgstr "" #: includes/admin/reports/class-wcs-report-subscription-events-by-date.php:785 #: includes/admin/reports/class-wcs-report-subscription-payment-retry.php:199 -#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:220 +#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:226 msgid "Export CSV" msgstr "" @@ -532,7 +532,7 @@ msgstr "" #. translators: %s: renewal count. #: includes/admin/reports/class-wcs-report-subscription-payment-retry.php:121 -#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:98 +#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:104 msgid "%s renewal orders" msgstr "" @@ -584,44 +584,44 @@ msgid "Recovered Renewal Revenue" msgstr "" #. translators: %s: formatted amount. -#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:91 +#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:97 msgid "%s renewal income in this period" msgstr "" -#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:92 +#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:98 msgid "The sum of all the upcoming renewal orders, including items, fees, tax and shipping, for currently active subscriptions." msgstr "" -#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:99 +#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:105 msgid "The number of upcoming renewal orders, for currently active subscriptions." msgstr "" #. translators: %s: formatted amount. -#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:105 +#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:111 msgid "%s average renewal amount" msgstr "" -#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:186 +#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:192 msgid "Next 12 Months" msgstr "" -#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:187 +#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:193 msgid "Next 30 Days" msgstr "" -#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:188 +#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:194 msgid "Next Month" msgstr "" -#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:189 +#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:195 msgid "Next 7 Days" msgstr "" -#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:254 +#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:260 msgid "Renewals count" msgstr "" -#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:263 +#: includes/admin/reports/class-wcs-report-upcoming-recurring-revenue.php:269 msgid "Renewals amount" msgstr "" diff --git a/vendor/autoload.php b/vendor/autoload.php index 2e2149c..5ba82ab 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) { require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitd13119b632d3cc9554ea23819396f4c1::getLoader(); +return ComposerAutoloaderInit7e691db14332db79e94ffb5244979d5e::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 0cd0a8f..2d7ce60 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitd13119b632d3cc9554ea23819396f4c1 +class ComposerAutoloaderInit7e691db14332db79e94ffb5244979d5e { private static $loader; @@ -24,12 +24,12 @@ class ComposerAutoloaderInitd13119b632d3cc9554ea23819396f4c1 require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInitd13119b632d3cc9554ea23819396f4c1', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit7e691db14332db79e94ffb5244979d5e', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInitd13119b632d3cc9554ea23819396f4c1', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit7e691db14332db79e94ffb5244979d5e', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitd13119b632d3cc9554ea23819396f4c1::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit7e691db14332db79e94ffb5244979d5e::getInitializer($loader)); $loader->register(true); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 6603525..bb89710 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitd13119b632d3cc9554ea23819396f4c1 +class ComposerStaticInit7e691db14332db79e94ffb5244979d5e { public static $prefixLengthsPsr4 = array ( 'C' => @@ -129,9 +129,9 @@ class ComposerStaticInitd13119b632d3cc9554ea23819396f4c1 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitd13119b632d3cc9554ea23819396f4c1::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitd13119b632d3cc9554ea23819396f4c1::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitd13119b632d3cc9554ea23819396f4c1::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit7e691db14332db79e94ffb5244979d5e::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit7e691db14332db79e94ffb5244979d5e::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit7e691db14332db79e94ffb5244979d5e::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 66f5429..e8f0fbb 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -156,17 +156,17 @@ }, { "name": "woocommerce/subscriptions-core", - "version": "7.4.2", - "version_normalized": "7.4.2.0", + "version": "7.4.3", + "version_normalized": "7.4.3.0", "source": { "type": "git", "url": "https://github.com/Automattic/woocommerce-subscriptions-core.git", - "reference": "f42488f6e31d078759dc917056f2ab34f2790e43" + "reference": "eba9c58a2fd2a65e55c533f24cd20af2084a8265" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/f42488f6e31d078759dc917056f2ab34f2790e43", - "reference": "f42488f6e31d078759dc917056f2ab34f2790e43", + "url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/eba9c58a2fd2a65e55c533f24cd20af2084a8265", + "reference": "eba9c58a2fd2a65e55c533f24cd20af2084a8265", "shasum": "" }, "require": { @@ -179,7 +179,7 @@ "woocommerce/woocommerce-sniffs": "0.1.0", "yoast/phpunit-polyfills": "1.1.0" }, - "time": "2024-08-27T00:36:09+00:00", + "time": "2024-09-05T02:55:11+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.4.2", + "source": "https://github.com/Automattic/woocommerce-subscriptions-core/tree/7.4.3", "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 edba209..574210b 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.6.1', - 'version' => 'dev-release/6.6.1', - 'reference' => '2c2bd10595b327e840fc5611433725df20bae33a', + 'pretty_version' => 'dev-release/6.6.2', + 'version' => 'dev-release/6.6.2', + 'reference' => 'dfdcf5705059ca03ecc9c5b2c21910f8c932b082', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -32,18 +32,18 @@ ), ), 'woocommerce/subscriptions-core' => array( - 'pretty_version' => '7.4.2', - 'version' => '7.4.2.0', - 'reference' => 'f42488f6e31d078759dc917056f2ab34f2790e43', + 'pretty_version' => '7.4.3', + 'version' => '7.4.3.0', + 'reference' => 'eba9c58a2fd2a65e55c533f24cd20af2084a8265', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../woocommerce/subscriptions-core', 'aliases' => array(), 'dev_requirement' => false, ), 'woocommerce/woocommerce-subscriptions' => array( - 'pretty_version' => 'dev-release/6.6.1', - 'version' => 'dev-release/6.6.1', - 'reference' => '2c2bd10595b327e840fc5611433725df20bae33a', + 'pretty_version' => 'dev-release/6.6.2', + 'version' => 'dev-release/6.6.2', + 'reference' => 'dfdcf5705059ca03ecc9c5b2c21910f8c932b082', '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 391253a..97814c0 100644 --- a/vendor/woocommerce/subscriptions-core/changelog.txt +++ b/vendor/woocommerce/subscriptions-core/changelog.txt @@ -1,5 +1,8 @@ *** WooCommerce Subscriptions Core Changelog *** += 7.4.3 - 2024-09-05 = +* Fix - Prevent errors during checkout when a customer is switching their subscription product and does not require payment. + = 7.4.2 - 2024-08-27 = * Fix - Resolved an issue where simple product prices were incorrectly set to $0 when purchasing subscriptions and simple products with a coupon in WC 9.2. @@ -10,12 +13,12 @@ * Dev - Introduce new parameter to WC_Subscription::get_last_order() to enable filtering out orders with specific statuses. * Update - Schedule subscription-related events with a priority of 1 to allow for earlier execution within the Action Scheduler. * Fix - Ensure admin notices are displayed after performing bulk actions on subscriptions when HPOS is enabled. +* Fix - Resolved an error when purchasing subscription products on the block checkout with a limited recurring coupon. = 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. -* Fix - Resolved an error when purchasing subscription products on the block checkout with a limited recurring coupon. = 7.2.0 - 2024-06-13 = * Fix - label improvement on my subscription page template. 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 00e2e85..3834ac5 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.4.2'; // WRCS: DEFINED_VERSION. + protected $library_version = '7.4.3'; // WRCS: DEFINED_VERSION. /** * The subscription scheduler instance. diff --git a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php index 9d34718..e3adbe3 100644 --- a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php +++ b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php @@ -694,7 +694,7 @@ class WC_Subscriptions_Order { } // Check if there's a subscription attached to this order that will require a payment method. - foreach ( wcs_get_subscriptions_for_order( $order ) as $subscription ) { + foreach ( wcs_get_subscriptions_for_order( $order, [ 'order_type' => 'parent' ] ) as $subscription ) { $has_next_payment = false; $contains_expiring_limited_coupon = false; $contains_free_trial = false; diff --git a/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php b/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php index 2948a2f..3c99e9f 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.4.2 + * Version: 7.4.3 */ diff --git a/woocommerce-subscriptions.php b/woocommerce-subscriptions.php index bb4a4a8..2407718 100644 --- a/woocommerce-subscriptions.php +++ b/woocommerce-subscriptions.php @@ -5,7 +5,7 @@ * Description: Sell products and services with recurring payments in your WooCommerce Store. * Author: WooCommerce * Author URI: https://woocommerce.com/ - * Version: 6.6.1 + * Version: 6.6.2 * Requires Plugins: woocommerce * * WC requires at least: 8.7.1 @@ -78,7 +78,7 @@ class WC_Subscriptions { public static $plugin_file = __FILE__; /** @var string */ - public static $version = '6.6.1'; // WRCS: DEFINED_VERSION. + public static $version = '6.6.2'; // WRCS: DEFINED_VERSION. /** @var string */ public static $wc_minimum_supported_version = '7.7';