diff --git a/changelog.txt b/changelog.txt index ae570d2..b4b6990 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,11 @@ *** WooCommerce Subscriptions Changelog *** +2023-07-26 - version 5.3.1 +* Fix: Resolved an issue that prevented the "Used for variations" checkbox to not be enabled on the edit product page load causing variations to be deleted erroneously. +* Dev: Fixed wcs_get_subscription_orders() returning an empty list when querying parent orders when HPOS is enabled with data syncing off. +* Dev: Use the WC_VERSION constant when determining the active WooCommerce version inside our dependency manager if it's defined. +* Dev: Updated subscriptions-core to 6.1.0 + 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. diff --git a/includes/class-wc-subscriptions-dependency-manager.php b/includes/class-wc-subscriptions-dependency-manager.php index f600368..7af2569 100644 --- a/includes/class-wc-subscriptions-dependency-manager.php +++ b/includes/class-wc-subscriptions-dependency-manager.php @@ -79,13 +79,20 @@ class WC_Subscriptions_Dependency_Manager { /** * This method detects the active version of WooCommerce. * - * The resulting version is based on the WooCommerce plugin data. The WooCommerce plugin is determined by this logic: + * If the WC_VERSION constant is already defined, use that as a first preference. + * If it's not defined, fetch the version based on the WooCommerce plugin data. + * + * The WooCommerce plugin is determined by this logic: * 1. Installed at 'woocommerce/woocommerce.php' * 2. Installed at any '{x}/woocommerce.php' where the plugin name is 'WooCommerce' * * @return string|null The active WooCommerce version, or null if WooCommerce is not active. */ private function get_woocommerce_active_version() { + if ( defined( 'WC_VERSION' ) ) { + return WC_VERSION; + } + // Use a cached value to avoid calling get_plugins() and looping multiple times. if ( true === $this->wc_version_cached ) { return $this->wc_active_version; diff --git a/languages/woocommerce-subscriptions.pot b/languages/woocommerce-subscriptions.pot index 8f12a3e..04006e1 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 5.3.0\n" +"Project-Id-Version: WooCommerce Subscriptions 5.3.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: 2023-07-19T03:29:55+00:00\n" +"POT-Creation-Date: 2023-07-26T05:12:54+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.8.1\n" "X-Domain: woocommerce-subscriptions\n" @@ -985,12 +985,12 @@ msgid "Meta value." msgstr "" #. translators: 1$-2$: opening and closing tags, 3$-4$: link tags, takes to woocommerce plugin on wp.org, 5$-6$: opening and closing link tags, leads to plugins.php in admin -#: includes/class-wc-subscriptions-dependency-manager.php:149 +#: includes/class-wc-subscriptions-dependency-manager.php:156 msgid "%1$sWooCommerce Subscriptions is inactive.%2$s The %3$sWooCommerce plugin%4$s must be active for WooCommerce Subscriptions to work. Please %5$sinstall & activate WooCommerce »%6$s" msgstr "" #. translators: 1$-2$: opening and closing tags, 3$: minimum supported WooCommerce version, 4$-5$: opening and closing link tags, leads to plugin admin -#: includes/class-wc-subscriptions-dependency-manager.php:152 +#: includes/class-wc-subscriptions-dependency-manager.php:159 msgid "%1$sWooCommerce Subscriptions is inactive.%2$s This version of Subscriptions requires WooCommerce %3$s or newer. Please %4$supdate WooCommerce to version %3$s or newer »%5$s" msgstr "" @@ -6024,11 +6024,11 @@ msgstr "" msgid "\"%s\" is not a valid new order type." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php:526 +#: vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php:533 msgid "Invalid data. No valid subscription / order was passed in." msgstr "" -#: vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php:530 +#: vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php:537 msgid "Invalid data. No valid item id was passed in." msgstr "" diff --git a/vendor/autoload.php b/vendor/autoload.php index f607f5f..4e39532 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 ComposerAutoloaderInit1ae0d000312c743ada5d59e74eb795da::getLoader(); +return ComposerAutoloaderInit8568f0690e3926c86f2dbdbb3a1ffeaa::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 0009b67..43f63c4 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit1ae0d000312c743ada5d59e74eb795da +class ComposerAutoloaderInit8568f0690e3926c86f2dbdbb3a1ffeaa { private static $loader; @@ -24,12 +24,12 @@ class ComposerAutoloaderInit1ae0d000312c743ada5d59e74eb795da require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInit1ae0d000312c743ada5d59e74eb795da', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit8568f0690e3926c86f2dbdbb3a1ffeaa', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit1ae0d000312c743ada5d59e74eb795da', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit8568f0690e3926c86f2dbdbb3a1ffeaa', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit1ae0d000312c743ada5d59e74eb795da::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit8568f0690e3926c86f2dbdbb3a1ffeaa::getInitializer($loader)); $loader->register(true); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 5e4b3cb..abecd9d 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit1ae0d000312c743ada5d59e74eb795da +class ComposerStaticInit8568f0690e3926c86f2dbdbb3a1ffeaa { public static $prefixLengthsPsr4 = array ( 'C' => @@ -129,9 +129,9 @@ class ComposerStaticInit1ae0d000312c743ada5d59e74eb795da public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit1ae0d000312c743ada5d59e74eb795da::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit1ae0d000312c743ada5d59e74eb795da::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit1ae0d000312c743ada5d59e74eb795da::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit8568f0690e3926c86f2dbdbb3a1ffeaa::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit8568f0690e3926c86f2dbdbb3a1ffeaa::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit8568f0690e3926c86f2dbdbb3a1ffeaa::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 0591680..b900c8f 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -156,17 +156,17 @@ }, { "name": "woocommerce/subscriptions-core", - "version": "6.0.0", - "version_normalized": "6.0.0.0", + "version": "6.1.0", + "version_normalized": "6.1.0.0", "source": { "type": "git", "url": "https://github.com/Automattic/woocommerce-subscriptions-core.git", - "reference": "b48c46a6a08b73d8afc7a0e686173c5b5c55ecbb" + "reference": "507720f600363a6c1e7da1b4b82660c7ab6a0c0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/b48c46a6a08b73d8afc7a0e686173c5b5c55ecbb", - "reference": "b48c46a6a08b73d8afc7a0e686173c5b5c55ecbb", + "url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/507720f600363a6c1e7da1b4b82660c7ab6a0c0e", + "reference": "507720f600363a6c1e7da1b4b82660c7ab6a0c0e", "shasum": "" }, "require": { @@ -179,7 +179,7 @@ "woocommerce/woocommerce-sniffs": "0.1.0", "yoast/phpunit-polyfills": "1.0.3" }, - "time": "2023-07-18T06:28:51+00:00", + "time": "2023-07-26T03:44:54+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/6.0.0", + "source": "https://github.com/Automattic/woocommerce-subscriptions-core/tree/6.1.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 b5b7f8a..08537f6 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => 'woocommerce/woocommerce-subscriptions', - 'pretty_version' => 'dev-trunk', - 'version' => 'dev-trunk', - 'reference' => '307075aa5a4fadd6012aa09c23368e4eb012ed8c', + 'pretty_version' => 'dev-release/5.3.1', + 'version' => 'dev-release/5.3.1', + 'reference' => 'de1d1429946caab29ede2bf2d5bc00b16180c916', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -32,18 +32,18 @@ ), ), 'woocommerce/subscriptions-core' => array( - 'pretty_version' => '6.0.0', - 'version' => '6.0.0.0', - 'reference' => 'b48c46a6a08b73d8afc7a0e686173c5b5c55ecbb', + 'pretty_version' => '6.1.0', + 'version' => '6.1.0.0', + 'reference' => '507720f600363a6c1e7da1b4b82660c7ab6a0c0e', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../woocommerce/subscriptions-core', 'aliases' => array(), 'dev_requirement' => false, ), 'woocommerce/woocommerce-subscriptions' => array( - 'pretty_version' => 'dev-trunk', - 'version' => 'dev-trunk', - 'reference' => '307075aa5a4fadd6012aa09c23368e4eb012ed8c', + 'pretty_version' => 'dev-release/5.3.1', + 'version' => 'dev-release/5.3.1', + 'reference' => 'de1d1429946caab29ede2bf2d5bc00b16180c916', '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 d050a37..9645d2c 100644 --- a/vendor/woocommerce/subscriptions-core/assets/js/admin/admin.js +++ b/vendor/woocommerce/subscriptions-core/assets/js/admin/admin.js @@ -667,6 +667,7 @@ jQuery( function ( $ ) { if ( $( '.options_group.pricing' ).length > 0 ) { $.setSalePeriod(); $.showHideSubscriptionMeta(); + $.enableSubscriptionProductFields(); $.showHideVariableSubscriptionMeta(); $.setSubscriptionLengths(); $.setTrialPeriods(); diff --git a/vendor/woocommerce/subscriptions-core/changelog.txt b/vendor/woocommerce/subscriptions-core/changelog.txt index 19bdccf..2a5b3d9 100644 --- a/vendor/woocommerce/subscriptions-core/changelog.txt +++ b/vendor/woocommerce/subscriptions-core/changelog.txt @@ -1,5 +1,10 @@ *** WooCommerce Subscriptions Core Changelog *** + += 6.1.0 - 2023-07-26 = +* Fix - Resolved an issue that prevented the "Used for variations" checkbox to not be enabled on the edit product page load causing variations to be deleted erroneously. +* Dev - Fixed wcs_get_subscription_orders() returning an empty list when querying parent orders when HPOS is enabled with data syncing off. + = 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. 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 169ff39..9bf515a 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 = '6.0.0'; // WRCS: DEFINED_VERSION. + protected $library_version = '6.1.0'; // WRCS: DEFINED_VERSION. /** * The subscription scheduler instance. diff --git a/vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php b/vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php index 797a5f6..24cbf7f 100644 --- a/vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php +++ b/vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php @@ -439,11 +439,18 @@ function wcs_get_subscription_orders( $return_fields = 'ids', $order_type = 'par $order_ids = array(); if ( $any_order_type || in_array( 'parent', $order_type ) ) { + $is_hpos = wcs_is_custom_order_tables_usage_enabled(); + $table_name = $is_hpos ? 'wc_orders' : 'posts'; + $parent_order_col = $is_hpos ? 'parent_order_id' : 'post_parent'; + $type_col = $is_hpos ? 'type' : 'post_type'; + + // @codingStandardsIgnoreStart $order_ids = array_merge( $order_ids, $wpdb->get_col( - "SELECT DISTINCT post_parent FROM {$wpdb->posts} - WHERE post_type = 'shop_subscription' - AND post_parent <> 0" + "SELECT DISTINCT {$parent_order_col} FROM {$wpdb->prefix}{$table_name} + WHERE {$type_col} = 'shop_subscription' + AND {$parent_order_col} <> 0" ) ); + // @codingStandardsIgnoreEnd } if ( $any_order_type || in_array( 'renewal', $order_type ) || in_array( 'resubscribe', $order_type ) || in_array( 'switch', $order_type ) ) { diff --git a/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php b/vendor/woocommerce/subscriptions-core/woocommerce-subscriptions-core.php index c1e7528..a5d9bf9 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: 6.0.0 + * Version: 6.1.0 */ diff --git a/woocommerce-subscriptions.php b/woocommerce-subscriptions.php index 6c8c61f..e566619 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: 5.3.0 + * Version: 5.3.1 * * WC requires at least: 6.5 * WC tested up to: 7.9.0 @@ -31,7 +31,7 @@ * @since 1.0 */ -require_once( 'includes/class-wc-subscriptions-dependency-manager.php' ); +require_once( __DIR__ . '/includes/class-wc-subscriptions-dependency-manager.php' ); $dependency_manager = new WC_Subscriptions_Dependency_Manager( WC_Subscriptions::$wc_minimum_supported_version ); // Check the dependencies before loading the plugin. If the dependencies are not met, display an admin notice and exit @@ -77,7 +77,7 @@ class WC_Subscriptions { public static $plugin_file = __FILE__; /** @var string */ - public static $version = '5.3.0'; // WRCS: DEFINED_VERSION. + public static $version = '5.3.1'; // WRCS: DEFINED_VERSION. /** @var string */ public static $wc_minimum_supported_version = '6.5';