diff --git a/changelog.txt b/changelog.txt index 3c4c2e0..ae570d2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,12 @@ *** WooCommerce Subscriptions Changelog *** +2023-07-19 - version 5.3.0 +* Fix: Ensure when a customer changes the shipping method on cart and checkout that the recurring totals correctly reflect the chosen method. +* Fix: Resolve an issue that prevented the "Used for variations" checkbox from being enabled on the variable subscription product edit screen on WC version v7.9.0. +* Fix: When HPOS is enabled, the `wc/v3/subscriptions` REST API endpoint will now fetch subscriptions of all statuses. +* Dev: Filter the WC_Order_Query args to properly query subscription statuses when HPOS is enabled. +* Dev: Updated subscriptions-core to 6.0.0 + 2023-07-05 - version 5.2.0 * Fix: Resolved an issue that prevented the selected Shipping Method from being saved when switching an assembled Product Bundle. * Fix: When HPOS is enabled, permanently deleting a subscription related order wasn't updating the related orders cache properly. diff --git a/languages/woocommerce-subscriptions.pot b/languages/woocommerce-subscriptions.pot index 51333b2..8f12a3e 100644 --- a/languages/woocommerce-subscriptions.pot +++ b/languages/woocommerce-subscriptions.pot @@ -2,16 +2,16 @@ # This file is distributed under the same license as the WooCommerce Subscriptions plugin. msgid "" msgstr "" -"Project-Id-Version: WooCommerce Subscriptions 5.2.0\n" +"Project-Id-Version: WooCommerce Subscriptions 5.3.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: 2023-07-05T05:07:01+00:00\n" +"POT-Creation-Date: 2023-07-19T03:29:55+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"X-Generator: WP-CLI 2.8.0\n" +"X-Generator: WP-CLI 2.8.1\n" "X-Domain: woocommerce-subscriptions\n" #. Plugin Name of the plugin @@ -1871,6 +1871,46 @@ msgstr "" msgid "Want to renew early via the checkout? Click %shere.%s" msgstr "" +#: tests/unit/scheduler/scheduler.php:65 +#: vendor/woocommerce/subscriptions-core/wcs-functions.php:291 +msgctxt "table heading" +msgid "Start Date" +msgstr "" + +#: tests/unit/scheduler/scheduler.php:66 +#: vendor/woocommerce/subscriptions-core/wcs-functions.php:292 +msgctxt "table heading" +msgid "Trial End" +msgstr "" + +#: tests/unit/scheduler/scheduler.php:67 +#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:40 +#: vendor/woocommerce/subscriptions-core/wcs-functions.php:293 +msgctxt "table heading" +msgid "Next Payment" +msgstr "" + +#: tests/unit/scheduler/scheduler.php:68 +#: vendor/woocommerce/subscriptions-core/templates/emails/cancelled-subscription.php:23 +#: vendor/woocommerce/subscriptions-core/templates/emails/expired-subscription.php:23 +#: vendor/woocommerce/subscriptions-core/templates/emails/on-hold-subscription.php:23 +#: vendor/woocommerce/subscriptions-core/wcs-functions.php:294 +msgctxt "table heading" +msgid "Last Order Date" +msgstr "" + +#: tests/unit/scheduler/scheduler.php:69 +#: vendor/woocommerce/subscriptions-core/wcs-functions.php:295 +msgctxt "table heading" +msgid "Cancelled Date" +msgstr "" + +#: tests/unit/scheduler/scheduler.php:70 +#: vendor/woocommerce/subscriptions-core/wcs-functions.php:296 +msgctxt "table heading" +msgid "End Date" +msgstr "" + #. translators: 1: relation type, 2: list of valid relation types. #: vendor/woocommerce/subscriptions-core/includes/abstracts/abstract-wcs-related-order-store.php:148 msgid "Invalid relation type: %1$s. Order relationship type must be one of: %2$s." @@ -3787,75 +3827,75 @@ msgstr "" msgid "Date Changed" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:334 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:336 msgid "Your subscription will be activated when payment clears." msgid_plural "Your subscriptions will be activated when payment clears." msgstr[0] "" msgstr[1] "" #. translators: placeholders are opening and closing link tags -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:341 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:343 msgid "View the status of your subscription in %1$syour account%2$s." msgid_plural "View the status of your subscriptions in %1$syour account%2$s." msgstr[0] "" msgstr[1] "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:404 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:406 msgid "Subscription Relationship" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:424 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:426 msgid "Renewal Order" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:426 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:428 msgid "Resubscribe Order" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:428 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:430 msgid "Parent Order" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:477 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:479 msgid "Payment completed on order after subscription was cancelled." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:713 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:715 msgid "All orders types" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:716 -msgctxt "An order type" -msgid "Original" -msgstr "" - -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:717 -msgctxt "An order type" -msgid "Subscription Parent" -msgstr "" - #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:718 msgctxt "An order type" -msgid "Subscription Renewal" +msgid "Original" msgstr "" #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:719 msgctxt "An order type" -msgid "Subscription Resubscribe" +msgid "Subscription Parent" msgstr "" #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:720 msgctxt "An order type" -msgid "Subscription Switch" +msgid "Subscription Renewal" msgstr "" #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:721 msgctxt "An order type" +msgid "Subscription Resubscribe" +msgstr "" + +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:722 +msgctxt "An order type" +msgid "Subscription Switch" +msgstr "" + +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:723 +msgctxt "An order type" msgid "Non-subscription" msgstr "" #. translators: $1: opening link tag, $2: order number, $3: closing link tag -#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:1024 +#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php:1026 msgid "Subscription cancelled for refunded order %1$s#%2$s%3$s." msgstr "" @@ -5800,27 +5840,27 @@ msgstr "" msgid "Shipping via %s" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php:237 +#: vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php:264 msgctxt "shipping method price" msgid "Free" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php:262 +#: vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php:289 msgid "[Remove]" msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php:292 +#: vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php:319 msgid "Free shipping coupon" msgstr "" #. translators: placeholder is price string, denotes tax included in cart/order total -#: vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php:330 +#: vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php:357 msgctxt "includes tax" msgid "(includes %s)" msgstr "" #. translators: placeholder is a date -#: vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php:405 +#: vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php:432 msgid "First renewal: %s" msgstr "" @@ -5984,11 +6024,11 @@ msgstr "" msgid "\"%s\" is not a valid new order type." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php:542 +#: vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php:526 msgid "Invalid data. No valid subscription / order was passed in." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php:546 +#: vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php:530 msgid "Invalid data. No valid item id was passed in." msgstr "" @@ -6328,14 +6368,6 @@ msgctxt "table headings in notification email" msgid "Price" msgstr "" -#: vendor/woocommerce/subscriptions-core/templates/emails/cancelled-subscription.php:23 -#: vendor/woocommerce/subscriptions-core/templates/emails/expired-subscription.php:23 -#: vendor/woocommerce/subscriptions-core/templates/emails/on-hold-subscription.php:23 -#: vendor/woocommerce/subscriptions-core/wcs-functions.php:294 -msgctxt "table heading" -msgid "Last Order Date" -msgstr "" - #: vendor/woocommerce/subscriptions-core/templates/emails/cancelled-subscription.php:24 msgctxt "table headings in notification email" msgid "End of Prepaid Term" @@ -6618,12 +6650,6 @@ msgstr "" msgid "ID" msgstr "" -#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:40 -#: vendor/woocommerce/subscriptions-core/wcs-functions.php:293 -msgctxt "table heading" -msgid "Next Payment" -msgstr "" - #: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:46 #: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:53 #: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:42 @@ -6803,26 +6829,6 @@ msgstr "" msgid "Can not get address type display name. Address type is not a string." msgstr "" -#: vendor/woocommerce/subscriptions-core/wcs-functions.php:291 -msgctxt "table heading" -msgid "Start Date" -msgstr "" - -#: vendor/woocommerce/subscriptions-core/wcs-functions.php:292 -msgctxt "table heading" -msgid "Trial End" -msgstr "" - -#: vendor/woocommerce/subscriptions-core/wcs-functions.php:295 -msgctxt "table heading" -msgid "Cancelled Date" -msgstr "" - -#: vendor/woocommerce/subscriptions-core/wcs-functions.php:296 -msgctxt "table heading" -msgid "End Date" -msgstr "" - #: vendor/woocommerce/subscriptions-core/wcs-functions.php:331 msgid "Date type is not a string." msgstr "" diff --git a/vendor/autoload.php b/vendor/autoload.php index c85f70a..f607f5f 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 ComposerAutoloaderInit33a9fa1eb707ddafd4d5a1bd7f21492d::getLoader(); +return ComposerAutoloaderInit1ae0d000312c743ada5d59e74eb795da::getLoader(); diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index a72151c..7824d8f 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -45,35 +45,34 @@ class ClassLoader /** @var \Closure(string):void */ private static $includeFile; - /** @var ?string */ + /** @var string|null */ private $vendorDir; // PSR-4 /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixLengthsPsr4 = array(); /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixDirsPsr4 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr4 = array(); // PSR-0 /** - * @var array[] - * @psalm-var array> + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> */ private $prefixesPsr0 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr0 = array(); @@ -81,8 +80,7 @@ class ClassLoader private $useIncludePath = false; /** - * @var string[] - * @psalm-var array + * @var array */ private $classMap = array(); @@ -90,21 +88,20 @@ class ClassLoader private $classMapAuthoritative = false; /** - * @var bool[] - * @psalm-var array + * @var array */ private $missingClasses = array(); - /** @var ?string */ + /** @var string|null */ private $apcuPrefix; /** - * @var self[] + * @var array */ private static $registeredLoaders = array(); /** - * @param ?string $vendorDir + * @param string|null $vendorDir */ public function __construct($vendorDir = null) { @@ -113,7 +110,7 @@ class ClassLoader } /** - * @return string[] + * @return array> */ public function getPrefixes() { @@ -125,8 +122,7 @@ class ClassLoader } /** - * @return array[] - * @psalm-return array> + * @return array> */ public function getPrefixesPsr4() { @@ -134,8 +130,7 @@ class ClassLoader } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirs() { @@ -143,8 +138,7 @@ class ClassLoader } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirsPsr4() { @@ -152,8 +146,7 @@ class ClassLoader } /** - * @return string[] Array of classname => path - * @psalm-return array + * @return array Array of classname => path */ public function getClassMap() { @@ -161,8 +154,7 @@ class ClassLoader } /** - * @param string[] $classMap Class to filename map - * @psalm-param array $classMap + * @param array $classMap Class to filename map * * @return void */ @@ -179,24 +171,25 @@ class ClassLoader * 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 string[]|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix + * @param list|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( - (array) $paths, + $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, - (array) $paths + $paths ); } @@ -205,19 +198,19 @@ class ClassLoader $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; + $this->prefixesPsr0[$first][$prefix] = $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], - (array) $paths + $paths ); } } @@ -226,9 +219,9 @@ class ClassLoader * 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 string[]|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @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 * * @throws \InvalidArgumentException * @@ -236,17 +229,18 @@ class ClassLoader */ public function addPsr4($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, - (array) $paths + $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { @@ -256,18 +250,18 @@ class ClassLoader throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; + $this->prefixDirsPsr4[$prefix] = $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], - (array) $paths + $paths ); } } @@ -276,8 +270,8 @@ class ClassLoader * 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 string[]|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories * * @return void */ @@ -294,8 +288,8 @@ class ClassLoader * 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 string[]|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException * @@ -481,9 +475,9 @@ class ClassLoader } /** - * Returns the currently registered loaders indexed by their corresponding vendor directories. + * Returns the currently registered loaders keyed by their corresponding vendor directories. * - * @return self[] + * @return array */ public static function getRegisteredLoaders() { diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index a28ebc4..0009b67 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit33a9fa1eb707ddafd4d5a1bd7f21492d +class ComposerAutoloaderInit1ae0d000312c743ada5d59e74eb795da { private static $loader; @@ -24,12 +24,12 @@ class ComposerAutoloaderInit33a9fa1eb707ddafd4d5a1bd7f21492d require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInit33a9fa1eb707ddafd4d5a1bd7f21492d', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit1ae0d000312c743ada5d59e74eb795da', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit33a9fa1eb707ddafd4d5a1bd7f21492d', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit1ae0d000312c743ada5d59e74eb795da', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit33a9fa1eb707ddafd4d5a1bd7f21492d::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit1ae0d000312c743ada5d59e74eb795da::getInitializer($loader)); $loader->register(true); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index de3e01f..5e4b3cb 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit33a9fa1eb707ddafd4d5a1bd7f21492d +class ComposerStaticInit1ae0d000312c743ada5d59e74eb795da { public static $prefixLengthsPsr4 = array ( 'C' => @@ -129,9 +129,9 @@ class ComposerStaticInit33a9fa1eb707ddafd4d5a1bd7f21492d public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit33a9fa1eb707ddafd4d5a1bd7f21492d::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit33a9fa1eb707ddafd4d5a1bd7f21492d::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit33a9fa1eb707ddafd4d5a1bd7f21492d::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit1ae0d000312c743ada5d59e74eb795da::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit1ae0d000312c743ada5d59e74eb795da::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit1ae0d000312c743ada5d59e74eb795da::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index e33ebeb..0591680 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -156,17 +156,17 @@ }, { "name": "woocommerce/subscriptions-core", - "version": "5.8.0", - "version_normalized": "5.8.0.0", + "version": "6.0.0", + "version_normalized": "6.0.0.0", "source": { "type": "git", "url": "https://github.com/Automattic/woocommerce-subscriptions-core.git", - "reference": "24db3cf51eb191edb21e79421387072194b59046" + "reference": "b48c46a6a08b73d8afc7a0e686173c5b5c55ecbb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/24db3cf51eb191edb21e79421387072194b59046", - "reference": "24db3cf51eb191edb21e79421387072194b59046", + "url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/b48c46a6a08b73d8afc7a0e686173c5b5c55ecbb", + "reference": "b48c46a6a08b73d8afc7a0e686173c5b5c55ecbb", "shasum": "" }, "require": { @@ -179,7 +179,7 @@ "woocommerce/woocommerce-sniffs": "0.1.0", "yoast/phpunit-polyfills": "1.0.3" }, - "time": "2023-07-05T04:17:20+00:00", + "time": "2023-07-18T06:28:51+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/5.8.0", + "source": "https://github.com/Automattic/woocommerce-subscriptions-core/tree/6.0.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 b6512e6..b5b7f8a 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'woocommerce/woocommerce-subscriptions', 'pretty_version' => 'dev-trunk', 'version' => 'dev-trunk', - 'reference' => '3654b75b4e4dc6fc0a87c6424910937660919214', + 'reference' => '307075aa5a4fadd6012aa09c23368e4eb012ed8c', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -32,9 +32,9 @@ ), ), 'woocommerce/subscriptions-core' => array( - 'pretty_version' => '5.8.0', - 'version' => '5.8.0.0', - 'reference' => '24db3cf51eb191edb21e79421387072194b59046', + 'pretty_version' => '6.0.0', + 'version' => '6.0.0.0', + 'reference' => 'b48c46a6a08b73d8afc7a0e686173c5b5c55ecbb', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../woocommerce/subscriptions-core', 'aliases' => array(), @@ -43,7 +43,7 @@ 'woocommerce/woocommerce-subscriptions' => array( 'pretty_version' => 'dev-trunk', 'version' => 'dev-trunk', - 'reference' => '3654b75b4e4dc6fc0a87c6424910937660919214', + 'reference' => '307075aa5a4fadd6012aa09c23368e4eb012ed8c', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/vendor/woocommerce/subscriptions-core/assets/js/admin/admin.js b/vendor/woocommerce/subscriptions-core/assets/js/admin/admin.js index 69f55ea..d050a37 100644 --- a/vendor/woocommerce/subscriptions-core/assets/js/admin/admin.js +++ b/vendor/woocommerce/subscriptions-core/assets/js/admin/admin.js @@ -86,6 +86,26 @@ jQuery( function ( $ ) { .addClass( 'form-row-last' ); } }, + enableSubscriptionProductFields: function () { + product_type = $( 'select#product-type' ).val(); + enable_type = ''; + + // Variable subscriptions need to enable variable product fields and subscriptions products need to enable simple product fields. + if ( 'variable-subscription' === product_type ) { + enable_type = 'variable' + } else if ( 'subscription' === product_type ) { + enable_type = 'simple'; + } + + if ( enable_type ) { + $( `.enable_if_${ enable_type }` ).each( function () { + $( this ).removeClass( 'disabled' ); + if ( $( this ).is( 'input' ) ) { + $( this ).prop( 'disabled', false ); + } + } ); + } + }, showOrHideStockFields: function () { if ( $( 'input#_manage_stock' ).is( ':checked' ) ) { $( 'div.stock_fields' ).show(); @@ -718,10 +738,35 @@ jQuery( function ( $ ) { $( 'body' ).on( 'woocommerce-product-type-change', function () { $.showHideSubscriptionMeta(); $.showHideVariableSubscriptionMeta(); + $.enableSubscriptionProductFields(); $.showHideSyncOptions(); $.showHideSubscriptionsPanels(); } ); + // WC Core enable/disable product fields when saving attributes. We need to make sure we re-enable our fields. + $( document.body ).on( 'woocommerce_attributes_saved', function () { + $.enableSubscriptionProductFields(); + } ); + + /** + * This function is called after WC Core fetches new attribute HTML and appends the elements asynchronously. + * It triggers relevant functions to hide/show and enable/disable fields. + * + * @see add_attribute_to_list() in assets/js/admin/meta-boxes-product.js + * + * Since there is no specific event to hook into when the async call is resolved, we rely on WC clicking + * the attribute metabox heading after fetching the HTML but before disabling the product fields. + * We take advantage of this by attaching a click event listener to the '.woocommerce_attribute.wc-metabox h3' + * element and waiting a short time before re-enabling the product fields. + */ + $( document ).on( 'click', '.woocommerce_attribute.wc-metabox h3', function() { + setTimeout( function() { + $.showHideSubscriptionMeta(); + $.showHideVariableSubscriptionMeta(); + $.enableSubscriptionProductFields(); + }, 100 ); + }); + $( 'input#_downloadable, input#_virtual' ).on( 'change', function () { $.showHideSubscriptionMeta(); $.showHideVariableSubscriptionMeta(); diff --git a/vendor/woocommerce/subscriptions-core/assets/js/frontend/wcs-cart.js b/vendor/woocommerce/subscriptions-core/assets/js/frontend/wcs-cart.js index 237c38d..9d8e365 100755 --- a/vendor/woocommerce/subscriptions-core/assets/js/frontend/wcs-cart.js +++ b/vendor/woocommerce/subscriptions-core/assets/js/frontend/wcs-cart.js @@ -19,6 +19,31 @@ jQuery( function ( $ ) { hide_non_applicable_coupons(); } ); + /** + * Update all subscriptions shipping methods which inherit the chosen method from the initial + * cart when the customer changes the shipping method. + */ + $( document ).on( + 'change', + 'select.shipping_method, :input[name^=shipping_method]', + function( event ) { + var shipping_method_option = $( event.target ); + var shipping_method_id = shipping_method_option.val(); + var package_index = shipping_method_option.data( 'index' ); + + // We're only interested in the initial cart shipping method options which have int package indexes. + if ( ! Number.isInteger( package_index ) ) { + return; + } + + // Find all recurring cart info elements with the same package index as the changed shipping method. + $( '.recurring-cart-shipping-mapping-info[data-index=' + package_index + ']' ).each( function() { + // Update the corresponding subscription's hidden chosen shipping method. + $( 'input[name="shipping_method[' + $( this ).data( 'recurring_index' ) + ']"]' ).val( shipping_method_id ); + } ); + } + ); + $( '.payment_methods [name="payment_method"]' ).on( 'click', function () { if ( $( this ).hasClass( 'supports-payment-method-changes' ) ) { $( '.update-all-subscriptions-payment-method-wrap' ).show(); diff --git a/vendor/woocommerce/subscriptions-core/changelog.txt b/vendor/woocommerce/subscriptions-core/changelog.txt index 75545ae..19bdccf 100644 --- a/vendor/woocommerce/subscriptions-core/changelog.txt +++ b/vendor/woocommerce/subscriptions-core/changelog.txt @@ -1,5 +1,11 @@ *** WooCommerce Subscriptions Core Changelog *** += 6.0.0 - 2023-07-18 = +* Fix - Resolve an issue that prevented the "Used for variations" checkbox from being enabled on the variable subscription product edit screen on WC version v7.9.0. + += 5.9.0 - 2023-07-14 = +* Fix - Ensure when a customer changes the shipping method on cart and checkout that the recurring totals correctly reflect the chosen method. + = 5.8.0 - 2023-07-05 = * Fix - When HPOS is enabled, permanently deleting a subscription related order wasn't updating the related orders cache properly. * Fix - Added logic to check if the recurring cart array is present before displaying the recurring totals section in the cart. 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 3c9cf00..169ff39 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 = '5.8.0'; // WRCS: DEFINED_VERSION. + protected $library_version = '6.0.0'; // 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 172a31a..a8108d8 100644 --- a/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php +++ b/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-order.php @@ -64,6 +64,8 @@ class WC_Subscriptions_Order { add_filter( 'woocommerce_payment_complete_order_status', __CLASS__ . '::maybe_autocomplete_order', 10, 3 ); add_filter( 'woocommerce_order_data_store_cpt_get_orders_query', array( __CLASS__, 'add_subscription_order_query_args' ), 10, 2 ); + + add_filter( 'woocommerce_order_query_args', array( __CLASS__, 'map_order_query_args_for_subscriptions' ) ); } /* @@ -1218,6 +1220,58 @@ class WC_Subscriptions_Order { return $query; } + /** + * Filter the query_vars of a wc_get_orders() query to map 'any' to be all valid subscription statuses instead of + * defaulting to only valid order statuses. + * + * @param $query_vars + * + * @return mixed + */ + public static function map_order_query_args_for_subscriptions( $query_vars ) { + if ( ! wcs_is_custom_order_tables_usage_enabled() ) { + return $query_vars; + } + + /** + * Map the 'any' status to wcs_get_subscription_statuses() in HPOS environments. + * + * In HPOS environments, the 'any' status now maps to wc_get_order_statuses() statuses. Whereas, in + * WP Post architecture 'any' meant any status except for ‘inherit’, ‘trash’ and ‘auto-draft’. + * + * If we're querying for subscriptions, we need to map 'any' to be all valid subscription statuses otherwise it would just search for order statuses. + */ + if ( isset( $query_vars['post_type'] ) && '' !== $query_vars['post_type'] ) { + // OrdersTableQuery::maybe_remap_args() will overwrite `type` with the `post_type` value. + if ( 'shop_subscription' !== $query_vars['post_type'] ) { + return $query_vars; + } + + // Simplify the type logic. + $query_vars['type'] = 'shop_subscription'; + unset( $query_vars['post_type'] ); + } + + if ( isset( $query_vars['type'] ) && 'shop_subscription' === $query_vars['type'] ) { + if ( isset( $query_vars['post_status'] ) && '' !== $query_vars['post_status'] ) { + // OrdersTableQuery::maybe_remap_args() will overwrite `status` with the `post_status` value. + if ( [ 'any' ] !== (array) $query_vars['post_status'] ) { + return $query_vars; + } + + // Simplify the status logic. + $query_vars['status'] = 'any'; + unset( $query_vars['post_status'] ); + } + + if ( [ 'any' ] === (array) $query_vars['status'] || [ '' ] === (array) $query_vars['status'] ) { + $query_vars['status'] = array_keys( wcs_get_subscription_statuses() ); + } + } + + return $query_vars; + } + /* Deprecated Functions */ /** diff --git a/vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php b/vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php index 65cf6d2..0f5dcca 100644 --- a/vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php +++ b/vendor/woocommerce/subscriptions-core/includes/wcs-cart-functions.php @@ -83,11 +83,11 @@ function wcs_cart_totals_shipping_html() { $chosen_recurring_method = empty( $package['rates'] ) ? '' : current( $package['rates'] )->id; } - $shipping_selection_displayed = false; - $only_one_shipping_option = count( $package['rates'] ) === 1; - $recurring_rates_match_intial_rates = isset( $package['rates'][ $chosen_initial_method ] ) && isset( $initial_packages[ $package_index ] ) && $package['rates'] == $initial_packages[ $package_index ]['rates']; + $shipping_selection_displayed = false; + $only_one_shipping_option = count( $package['rates'] ) === 1; + $recurring_rates_match_initial_rates = isset( $package['rates'][ $chosen_initial_method ] ) && isset( $initial_packages[ $package_index ] ) && $package['rates'] == $initial_packages[ $package_index ]['rates']; // phpcs:ignore WordPress.PHP.StrictComparisons - if ( $only_one_shipping_option || ( $recurring_rates_match_intial_rates && apply_filters( 'wcs_cart_totals_shipping_html_price_only', true, $package, $recurring_cart ) ) ) { + if ( $only_one_shipping_option || ( $recurring_rates_match_initial_rates && apply_filters( 'wcs_cart_totals_shipping_html_price_only', true, $package, $recurring_cart ) ) ) { $shipping_method = ( 1 === count( $package['rates'] ) ) ? current( $package['rates'] ) : $package['rates'][ $chosen_initial_method ]; // packages match, display shipping amounts only ?> @@ -110,6 +110,9 @@ function wcs_cart_totals_shipping_html() { ' . esc_html( $package_details ) . '

'; ?> + + + ', + esc_attr( $shipping_method_index ), + esc_attr( $package_index ), + esc_attr( $recurring_cart_key ) + ); +} + /** * Display a recurring shipping methods price & name as a label * diff --git a/vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php b/vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php index a880b16..797a5f6 100644 --- a/vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php +++ b/vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php @@ -406,22 +406,6 @@ function wcs_get_orders_with_meta_query( $args ) { add_filter( 'woocommerce_order_data_store_cpt_get_orders_query', $handle_meta, 10, 2 ); } - /** - * Map the 'any' status to wcs_get_subscription_statuses() in HPOS environments. - * - * In HPOS environments, the 'any' status now maps to wc_get_order_statuses() statuses. Whereas, in - * WP Post architecture 'any' meant any status except for ‘inherit’, ‘trash’ and ‘auto-draft’. - * - * If we're querying for subscriptions, we need to map 'any' to be all valid subscription statuses otherwise it would just search for order statuses. - */ - if ( isset( $args['status'], $args['type'] ) && - [ 'any' ] === (array) $args['status'] && - 'shop_subscription' === $args['type'] && - $is_hpos_in_use - ) { - $args['status'] = array_keys( wcs_get_subscription_statuses() ); - } - $results = wc_get_orders( $args ); if ( ! $is_hpos_in_use ) { diff --git a/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php b/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php index c961785..c1e7528 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: 5.8.0 + * Version: 6.0.0 */ diff --git a/woocommerce-subscriptions.php b/woocommerce-subscriptions.php index 5b74595..6c8c61f 100644 --- a/woocommerce-subscriptions.php +++ b/woocommerce-subscriptions.php @@ -5,10 +5,10 @@ * Description: Sell products and services with recurring payments in your WooCommerce Store. * Author: WooCommerce * Author URI: https://woocommerce.com/ - * Version: 5.2.0 + * Version: 5.3.0 * * WC requires at least: 6.5 - * WC tested up to: 7.8.0 + * WC tested up to: 7.9.0 * Woo: 27147:6115e6d7e297b623a169fdcf5728b224 * * Copyright 2019 WooCommerce @@ -77,7 +77,7 @@ class WC_Subscriptions { public static $plugin_file = __FILE__; /** @var string */ - public static $version = '5.2.0'; // WRCS: DEFINED_VERSION. + public static $version = '5.3.0'; // WRCS: DEFINED_VERSION. /** @var string */ public static $wc_minimum_supported_version = '6.5';