From ca6f1789c9e47068c82f48c20201b48fe6ea918e Mon Sep 17 00:00:00 2001 From: WooCommerce Date: Tue, 27 Aug 2024 10:13:56 +0000 Subject: [PATCH] Updates to 6.6.0 --- changelog.txt | 4 + languages/woocommerce-subscriptions.pot | 51 +++++----- vendor/autoload.php | 2 +- vendor/composer/ClassLoader.php | 96 ++++++++++--------- 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 | 3 + .../includes/class-wc-subscriptions-cart.php | 61 +++++++++++- .../class-wc-subscriptions-core-plugin.php | 2 +- .../includes/class-wcs-limiter.php | 2 +- .../woocommerce-subscriptions-core.php | 2 +- woocommerce-subscriptions.php | 6 +- 14 files changed, 171 insertions(+), 106 deletions(-) diff --git a/changelog.txt b/changelog.txt index 7cef858..81ca0dd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ *** WooCommerce Subscriptions Changelog *** +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. + 2024-08-22 - version 6.6.0 * Fix: Resolve duplicate subscription creation and PHP warning when switching subscriptions with Prepaid for WooCommerce Subscriptions plugin active. * Fix: Switch calculations now exclude previous switch orders with a checkout-draft status. diff --git a/languages/woocommerce-subscriptions.pot b/languages/woocommerce-subscriptions.pot index c09a869..c07bd6a 100644 --- a/languages/woocommerce-subscriptions.pot +++ b/languages/woocommerce-subscriptions.pot @@ -2,43 +2,38 @@ # This file is distributed under the same license as the WooCommerce Subscriptions plugin. msgid "" msgstr "" -"Project-Id-Version: WooCommerce Subscriptions 6.6.0\n" +"Project-Id-Version: WooCommerce Subscriptions 6.6.1\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-22T07:20:55+00:00\n" +"POT-Creation-Date: 2024-08-27T01:02:31+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"X-Generator: WP-CLI 2.11.0\n" +"X-Generator: WP-CLI 2.9.0\n" "X-Domain: woocommerce-subscriptions\n" #. Plugin Name of the plugin -#: woocommerce-subscriptions.php #: vendor/woocommerce/subscriptions-core/includes/privacy/class-wcs-privacy.php:40 msgid "WooCommerce Subscriptions" msgstr "" #. Plugin URI of the plugin -#: woocommerce-subscriptions.php msgid "https://www.woocommerce.com/products/woocommerce-subscriptions/" msgstr "" #. Description of the plugin -#: woocommerce-subscriptions.php msgid "Sell products and services with recurring payments in your WooCommerce Store." msgstr "" #. Author of the plugin -#: woocommerce-subscriptions.php #: includes/admin/class-wcs-admin-reports.php:136 #: includes/admin/reports/class-wcs-report-cache-manager.php:262 msgid "WooCommerce" msgstr "" #. Author URI of the plugin -#: woocommerce-subscriptions.php msgid "https://woocommerce.com/" msgstr "" @@ -2021,7 +2016,7 @@ msgid "Optionally include an amount to be charged at the outset of the subscript msgstr "" #: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:374 -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2422 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2479 #: vendor/woocommerce/subscriptions-core/templates/admin/html-variation-price.php:25 msgid "Free trial" msgstr "" @@ -3164,28 +3159,28 @@ msgid "Your cart has been emptied of subscription products. Only one subscriptio msgstr "" #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart-validator.php:130 -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:1482 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:1539 msgid "That subscription product can not be added to your cart as it already contains a subscription renewal." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:483 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:540 msgid "Initial Shipment" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:922 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:979 msgid "Please enter a valid postcode/ZIP." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:1120 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:1177 msgid "Invalid recurring shipping method." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2158 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2215 msgid "now" msgstr "" #. translators: placeholder is a number of days. -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2317 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2374 #: vendor/woocommerce/subscriptions-core/includes/wcs-time-functions.php:58 msgid "%s day" msgid_plural "%s days" @@ -3193,7 +3188,7 @@ msgstr[0] "" msgstr[1] "" #. translators: placeholder is a number of weeks. -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2321 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2378 #: vendor/woocommerce/subscriptions-core/includes/wcs-time-functions.php:60 msgid "%s week" msgid_plural "%s weeks" @@ -3201,7 +3196,7 @@ msgstr[0] "" msgstr[1] "" #. translators: placeholder is a number of months. -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2325 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2382 #: vendor/woocommerce/subscriptions-core/includes/wcs-time-functions.php:62 msgid "%s month" msgid_plural "%s months" @@ -3209,7 +3204,7 @@ msgstr[0] "" msgstr[1] "" #. translators: placeholder is a number of years. -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2329 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2386 #: vendor/woocommerce/subscriptions-core/includes/wcs-time-functions.php:64 msgid "%s year" msgid_plural "%s years" @@ -3217,49 +3212,49 @@ msgstr[0] "" msgstr[1] "" #. translators: 1$: day of the week (e.g. "every Wednesday"). -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2351 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2408 msgid "every %1$s" msgstr "" #. translators: 1$: period, 2$: day of the week (e.g. "every 2nd week on Wednesday"). -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2355 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2412 msgid "every %1$s on %2$s" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2364 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2421 msgid "on the last day of each month" msgstr "" #. translators: 1$: day of the month (e.g. "23rd") (e.g. "every 23rd of each month"). -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2368 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2425 msgid "on the %1$s of each month" msgstr "" #. translators: 1$: interval (e.g. "3rd") (e.g. "on the last day of every 3rd month"). -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2376 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2433 msgid "on the last day of every %1$s month" msgstr "" #. translators: on the, 1$: day of every, 2$: month (e.g. "on the 23rd day of every 2nd month"). -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2382 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2439 msgid "on the %1$s day of every %2$s month" msgstr "" #. translators: on, 1$: , 2$: each year (e.g. "on March 15th each year"). -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2393 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2450 msgid "on %1$s %2$s each year" msgstr "" #. translators: 1$: month (e.g. "March"), 2$: day of the month (e.g. "23rd), 3$: interval year (r.g March 23rd every 2nd year"). -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2400 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2457 msgid "on %1$s %2$s every %3$s year" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2432 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2489 msgid "Sign up fee" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2442 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:2499 msgid "Renews" msgstr "" diff --git a/vendor/autoload.php b/vendor/autoload.php index cb8d99d..2e2149c 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit47c9a4f297bb3855920928bfaa252bb8::getLoader(); +return ComposerAutoloaderInitd13119b632d3cc9554ea23819396f4c1::getLoader(); diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index 7824d8f..a72151c 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -45,34 +45,35 @@ class ClassLoader /** @var \Closure(string):void */ private static $includeFile; - /** @var string|null */ + /** @var ?string */ private $vendorDir; // PSR-4 /** - * @var array> + * @var array[] + * @psalm-var array> */ private $prefixLengthsPsr4 = array(); /** - * @var array> + * @var array[] + * @psalm-var array> */ private $prefixDirsPsr4 = array(); /** - * @var list + * @var array[] + * @psalm-var array */ private $fallbackDirsPsr4 = array(); // PSR-0 /** - * List of PSR-0 prefixes - * - * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) - * - * @var array>> + * @var array[] + * @psalm-var array> */ private $prefixesPsr0 = array(); /** - * @var list + * @var array[] + * @psalm-var array */ private $fallbackDirsPsr0 = array(); @@ -80,7 +81,8 @@ class ClassLoader private $useIncludePath = false; /** - * @var array + * @var string[] + * @psalm-var array */ private $classMap = array(); @@ -88,20 +90,21 @@ class ClassLoader private $classMapAuthoritative = false; /** - * @var array + * @var bool[] + * @psalm-var array */ private $missingClasses = array(); - /** @var string|null */ + /** @var ?string */ private $apcuPrefix; /** - * @var array + * @var self[] */ private static $registeredLoaders = array(); /** - * @param string|null $vendorDir + * @param ?string $vendorDir */ public function __construct($vendorDir = null) { @@ -110,7 +113,7 @@ public function __construct($vendorDir = null) } /** - * @return array> + * @return string[] */ public function getPrefixes() { @@ -122,7 +125,8 @@ public function getPrefixes() } /** - * @return array> + * @return array[] + * @psalm-return array> */ public function getPrefixesPsr4() { @@ -130,7 +134,8 @@ public function getPrefixesPsr4() } /** - * @return list + * @return array[] + * @psalm-return array */ public function getFallbackDirs() { @@ -138,7 +143,8 @@ public function getFallbackDirs() } /** - * @return list + * @return array[] + * @psalm-return array */ public function getFallbackDirsPsr4() { @@ -146,7 +152,8 @@ public function getFallbackDirsPsr4() } /** - * @return array Array of classname => path + * @return string[] Array of classname => path + * @psalm-return array */ public function getClassMap() { @@ -154,7 +161,8 @@ public function getClassMap() } /** - * @param array $classMap Class to filename map + * @param string[] $classMap Class to filename map + * @psalm-param array $classMap * * @return void */ @@ -171,25 +179,24 @@ public function addClassMap(array $classMap) * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param list|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories * * @return void */ public function add($prefix, $paths, $prepend = false) { - $paths = (array) $paths; if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( - $paths, + (array) $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, - $paths + (array) $paths ); } @@ -198,19 +205,19 @@ public function add($prefix, $paths, $prepend = false) $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = $paths; + $this->prefixesPsr0[$first][$prefix] = (array) $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( - $paths, + (array) $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], - $paths + (array) $paths ); } } @@ -219,9 +226,9 @@ public function add($prefix, $paths, $prepend = false) * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param list|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException * @@ -229,18 +236,17 @@ public function add($prefix, $paths, $prepend = false) */ public function addPsr4($prefix, $paths, $prepend = false) { - $paths = (array) $paths; if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( - $paths, + (array) $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, - $paths + (array) $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { @@ -250,18 +256,18 @@ public function addPsr4($prefix, $paths, $prepend = false) throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = $paths; + $this->prefixDirsPsr4[$prefix] = (array) $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( - $paths, + (array) $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], - $paths + (array) $paths ); } } @@ -270,8 +276,8 @@ public function addPsr4($prefix, $paths, $prepend = false) * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param list|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 base directories * * @return void */ @@ -288,8 +294,8 @@ public function set($prefix, $paths) * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param list|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException * @@ -475,9 +481,9 @@ public function findFile($class) } /** - * Returns the currently registered loaders keyed by their corresponding vendor directories. + * Returns the currently registered loaders indexed by their corresponding vendor directories. * - * @return array + * @return self[] */ public static function getRegisteredLoaders() { diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 195c6a3..0cd0a8f 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit47c9a4f297bb3855920928bfaa252bb8 +class ComposerAutoloaderInitd13119b632d3cc9554ea23819396f4c1 { private static $loader; @@ -24,12 +24,12 @@ public static function getLoader() require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInit47c9a4f297bb3855920928bfaa252bb8', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitd13119b632d3cc9554ea23819396f4c1', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit47c9a4f297bb3855920928bfaa252bb8', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitd13119b632d3cc9554ea23819396f4c1', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit47c9a4f297bb3855920928bfaa252bb8::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitd13119b632d3cc9554ea23819396f4c1::getInitializer($loader)); $loader->register(true); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index c9f2e19..6603525 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit47c9a4f297bb3855920928bfaa252bb8 +class ComposerStaticInitd13119b632d3cc9554ea23819396f4c1 { public static $prefixLengthsPsr4 = array ( 'C' => @@ -129,9 +129,9 @@ class ComposerStaticInit47c9a4f297bb3855920928bfaa252bb8 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit47c9a4f297bb3855920928bfaa252bb8::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit47c9a4f297bb3855920928bfaa252bb8::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit47c9a4f297bb3855920928bfaa252bb8::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitd13119b632d3cc9554ea23819396f4c1::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitd13119b632d3cc9554ea23819396f4c1::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitd13119b632d3cc9554ea23819396f4c1::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index a71f190..66f5429 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -156,17 +156,17 @@ }, { "name": "woocommerce/subscriptions-core", - "version": "7.4.1", - "version_normalized": "7.4.1.0", + "version": "7.4.2", + "version_normalized": "7.4.2.0", "source": { "type": "git", "url": "https://github.com/Automattic/woocommerce-subscriptions-core.git", - "reference": "cfe4169e9c770baf4f3734c6e2baa9a014c023ba" + "reference": "f42488f6e31d078759dc917056f2ab34f2790e43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/cfe4169e9c770baf4f3734c6e2baa9a014c023ba", - "reference": "cfe4169e9c770baf4f3734c6e2baa9a014c023ba", + "url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/f42488f6e31d078759dc917056f2ab34f2790e43", + "reference": "f42488f6e31d078759dc917056f2ab34f2790e43", "shasum": "" }, "require": { @@ -179,7 +179,7 @@ "woocommerce/woocommerce-sniffs": "0.1.0", "yoast/phpunit-polyfills": "1.1.0" }, - "time": "2024-08-21T09:17:35+00:00", + "time": "2024-08-27T00:36:09+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.1", + "source": "https://github.com/Automattic/woocommerce-subscriptions-core/tree/7.4.2", "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 ccdda5f..edba209 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.0', - 'version' => 'dev-release/6.6.0', - 'reference' => '0e08ee41671d4cc44c73224008901acd210d4686', + 'pretty_version' => 'dev-release/6.6.1', + 'version' => 'dev-release/6.6.1', + 'reference' => '2c2bd10595b327e840fc5611433725df20bae33a', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -32,18 +32,18 @@ ), ), 'woocommerce/subscriptions-core' => array( - 'pretty_version' => '7.4.1', - 'version' => '7.4.1.0', - 'reference' => 'cfe4169e9c770baf4f3734c6e2baa9a014c023ba', + 'pretty_version' => '7.4.2', + 'version' => '7.4.2.0', + 'reference' => 'f42488f6e31d078759dc917056f2ab34f2790e43', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../woocommerce/subscriptions-core', 'aliases' => array(), 'dev_requirement' => false, ), 'woocommerce/woocommerce-subscriptions' => array( - 'pretty_version' => 'dev-release/6.6.0', - 'version' => 'dev-release/6.6.0', - 'reference' => '0e08ee41671d4cc44c73224008901acd210d4686', + 'pretty_version' => 'dev-release/6.6.1', + 'version' => 'dev-release/6.6.1', + 'reference' => '2c2bd10595b327e840fc5611433725df20bae33a', '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 15e3c5c..391253a 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.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. + = 7.4.1 - 2024-08-21 = * Fix - Add a year to the next renewal date billing interval is 12 months or more for a synced subscription. diff --git a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php index 6212a7b..9329303 100644 --- a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php +++ b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php @@ -47,6 +47,16 @@ class WC_Subscriptions_Cart { */ private static $cached_recurring_cart = null; + /** + * A stack of recurring cart keys being calculated. + * + * Before calculating a cart's totals, we set the recurring cart key and calculation type to match that cart's key and type. @see self::set_recurring_cart_key_before_calculate_totals() + * After a cart's totals have been calculated, we restore the recurring cart key and calculation type. @see self::update_recurring_cart_key_after_calculate_totals() + * + * @var array + */ + private static $recurring_totals_calculation_stack = []; + /** * Bootstraps the class and hooks required actions & filters. * @@ -113,6 +123,10 @@ public static function init() { // Redirect the user immediately to the checkout page after clicking "Sign Up Now" buttons to encourage immediate checkout add_filter( 'woocommerce_add_to_cart_redirect', array( __CLASS__, 'add_to_cart_redirect' ) ); + + // Set the recurring cart being calculated. + add_action( 'woocommerce_before_calculate_totals', [ __CLASS__, 'set_recurring_cart_key_before_calculate_totals' ], 1 ); + add_action( 'woocommerce_after_calculate_totals', [ __CLASS__, 'update_recurring_cart_key_after_calculate_totals' ], 1 ); } /** @@ -226,6 +240,37 @@ public static function set_subscription_prices_for_calculation( $price, $product return $price; } + /** + * Sets the recurring cart key and calculation type before calculating a carts totals. + * + * @param WC_Cart $cart The cart object being calculated. + */ + public static function set_recurring_cart_key_before_calculate_totals( $cart ) { + $recurring_cart_key = ! empty( $cart->recurring_cart_key ) ? $cart->recurring_cart_key : 'none'; + + // Store the recurring cart key in the stack. + array_unshift( self::$recurring_totals_calculation_stack, $recurring_cart_key ); + + // Set the current recurring cart key and calculation type. + self::set_recurring_cart_key( $recurring_cart_key ); + self::set_calculation_type( 'none' === $recurring_cart_key ? 'none' : 'recurring_total' ); + } + + /** + * Updates the recurring cart key and calculation type after calculating a carts totals. + * + * @param WC_Cart $cart The cart object that finished calculating it's totals. + */ + public static function update_recurring_cart_key_after_calculate_totals( $cart ) { + // Remove the recurring cart key from the stack. It has finished calculating. + array_shift( self::$recurring_totals_calculation_stack ); + + $recurring_cart_key = empty( self::$recurring_totals_calculation_stack ) ? 'none' : reset( self::$recurring_totals_calculation_stack ); + + self::set_recurring_cart_key( $recurring_cart_key ); + self::set_calculation_type( 'none' === $recurring_cart_key ? 'none' : 'recurring_total' ); + } + /** * Calculate the initial and recurring totals for all subscription products in the cart. * @@ -243,9 +288,21 @@ public static function set_subscription_prices_for_calculation( $price, $product * @version 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 */ public static function calculate_subscription_totals( $total, $cart ) { - if ( ! self::cart_contains_subscription() && ! wcs_cart_contains_resubscribe() ) { // cart doesn't contain subscription + // If the cart doesn't contain a subscription, skip calculating recurring totals. + if ( ! self::cart_contains_subscription() && ! wcs_cart_contains_resubscribe() ) { return $total; - } elseif ( 'none' != self::$calculation_type ) { // We're in the middle of a recalculation, let it run + } + + // We're in the middle of a recalculation, let it run. + if ( 'none' !== self::$calculation_type ) { + return $total; + } + + /** + * If we're in the middle of calculating recurring totals, skip this calculation to avoid infinite loops. + * We use whether there's a recurring cart key in the calculation stack (ie has started but hasn't finished) to determine if we're in the middle calculating recurring totals. + */ + if ( ! empty( array_diff( self::$recurring_totals_calculation_stack, [ 'none' ] ) ) ) { return $total; } 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 9c1f213..00e2e85 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.1'; // WRCS: DEFINED_VERSION. + protected $library_version = '7.4.2'; // WRCS: DEFINED_VERSION. /** * The subscription scheduler instance. diff --git a/vendor/woocommerce/subscriptions-core/includes/class-wcs-limiter.php b/vendor/woocommerce/subscriptions-core/includes/class-wcs-limiter.php index df9c120..5da7a81 100644 --- a/vendor/woocommerce/subscriptions-core/includes/class-wcs-limiter.php +++ b/vendor/woocommerce/subscriptions-core/includes/class-wcs-limiter.php @@ -46,7 +46,7 @@ public static function admin_edit_product_fields() { 'class' => 'wc-enhanced-select', 'label' => __( 'Limit subscription', 'woocommerce-subscriptions' ), // translators: placeholders are opening and closing link tags - 'description' => sprintf( __( 'Only allow a customer to have one subscription to this product. %1$sLearn more%2$s.', 'woocommerce-subscriptions' ), '', '' ), + 'description' => sprintf( __( 'Only allow a customer to have one subscription to this product. %1$sLearn more%2$s.', 'woocommerce-subscriptions' ), '', '' ), 'options' => array( 'no' => __( 'Do not limit', 'woocommerce-subscriptions' ), 'active' => __( 'Limit to one active subscription', 'woocommerce-subscriptions' ), diff --git a/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php b/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php index 7a97d3e..2948a2f 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.1 + * Version: 7.4.2 */ diff --git a/woocommerce-subscriptions.php b/woocommerce-subscriptions.php index 5512490..bb4a4a8 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.6.0 + * Version: 6.6.1 * Requires Plugins: woocommerce * * WC requires at least: 8.7.1 - * WC tested up to: 9.1.0 + * WC tested up to: 9.2.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.6.0'; // WRCS: DEFINED_VERSION. + public static $version = '6.6.1'; // WRCS: DEFINED_VERSION. /** @var string */ public static $wc_minimum_supported_version = '7.7';