Updates to 7.0.0

This commit is contained in:
WooCommerce 2025-01-10 10:16:08 +00:00
parent 60a125d936
commit 15b2c611fc
19 changed files with 372 additions and 111 deletions

View File

@ -1,5 +1,15 @@
*** WooCommerce Subscriptions Changelog ***
2025-01-10 - version 7.1.0
* Add: Compatibility with WooCommerce's new preview email feature introduced in 9.6.
* Fix: Prevents PHP fatal error when wcs_can_user_renew_early() is called with a non-existent subscription ID.
* Fix: Prevent payment gateways that complete Change Payment requests asynchronously from blocking future attempts to update payment methods for all subscriptions.
* Fix: Resolved an issue that could lead to undefined variable when attempting to send a customer notification email with no order.
* Fix: Prevents the customer's postal code being used as their billing city in the current session, following a change to payment details.
* Dev: Use the subscription's customer ID during the `wcs_can_user_renew_early()` function call when sending customer notification emails.
* Dev: Fix PHP deprecated warnings caused by calling esc_url with null.
* Dev: Update subscriptions-core to 7.9
2024-12-16 - version 7.0.0
* Fix: Prevent failing non-recent renewal order from suspending the subscription and marking the most recent renewal order as failed.
* Fix: Use block theme-styled buttons for subscription and related-orders actions on My Account pages.

View File

@ -66,15 +66,15 @@ function wcs_can_user_renew_early( $subscription, $user_id = 0 ) {
! boolval( apply_filters( 'wcs_allow_synced_product_early_renewal', false, $subscription ) )
) {
$reason = 'subscription_contains_synced_product';
}
} else {
// Make sure all line items still exist.
foreach ( $subscription->get_items() as $line_item ) {
$product = wc_get_product( wcs_get_canonical_product_id( $line_item ) );
// Make sure all line items still exist.
foreach ( $subscription->get_items() as $line_item ) {
$product = wc_get_product( wcs_get_canonical_product_id( $line_item ) );
if ( false === $product ) {
$reason = 'line_item_no_longer_exists';
break;
if ( false === $product ) {
$reason = 'line_item_no_longer_exists';
break;
}
}
}

View File

@ -1,15 +1,15 @@
# Copyright (C) 2024 WooCommerce
# Copyright (C) 2025 WooCommerce
# This file is distributed under the same license as the WooCommerce Subscriptions plugin.
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce Subscriptions 7.0.0\n"
"Project-Id-Version: WooCommerce Subscriptions 7.1.0\n"
"Report-Msgid-Bugs-To: https://woocommerce.com/contact-us\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-12-16T23:30:24+00:00\n"
"POT-Creation-Date: 2025-01-10T00:50:30+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.11.0\n"
"X-Domain: woocommerce-subscriptions\n"
@ -56,8 +56,8 @@ msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-wc-admin-manager.php:41
#: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-wc-admin-manager.php:51
#: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-wc-admin-manager.php:93
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:392
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:405
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:393
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:406
#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:108
#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:133
#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:289
@ -1075,7 +1075,7 @@ msgid "Add a Subscription Product"
msgstr ""
#: includes/class-wc-subscriptions-plugin.php:227
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:573
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:574
#: vendor/woocommerce/subscriptions-core/includes/upgrades/templates/wcs-about-2-0.php:35
#: vendor/woocommerce/subscriptions-core/includes/upgrades/templates/wcs-about.php:34
msgid "Settings"
@ -1271,7 +1271,7 @@ msgid "Welcome to WooCommerce Subscriptions %s!"
msgstr ""
#: includes/class-wcs-upgrade-notice-manager.php:112
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:345
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:355
#: vendor/woocommerce/subscriptions-core/includes/class-wcs-failed-scheduled-action-manager.php:232
msgid "Learn more"
msgstr ""
@ -2178,7 +2178,7 @@ msgid "Manage Subscriptions"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/admin/class-wc-subscriptions-admin.php:1006
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:401
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:402
msgid "Search Subscriptions"
msgstr ""
@ -2481,7 +2481,7 @@ msgid "Status"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-post-types.php:469
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:393
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:394
#: vendor/woocommerce/subscriptions-core/templates/emails/cancelled-subscription.php:21
#: vendor/woocommerce/subscriptions-core/templates/emails/expired-subscription.php:21
#: vendor/woocommerce/subscriptions-core/templates/emails/on-hold-subscription.php:21
@ -3212,7 +3212,7 @@ msgstr ""
#. translators: %s: order number.
#. translators: placeholder is a subscription ID.
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-addresses.php:242
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:756
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:763
#: vendor/woocommerce/subscriptions-core/includes/class-wcs-query.php:101
msgctxt "hash before order number"
msgid "Subscription #%s"
@ -3391,44 +3391,44 @@ msgctxt "label on button, imperative"
msgid "Add payment"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:319
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:323
msgid "Payment method updated."
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:319
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:323
msgid "Payment method added."
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:372
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:374
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:376
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:378
msgid "Payment method updated for all your current subscriptions."
msgstr ""
#. translators: 1: old payment title, 2: new payment title.
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:534
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:541
msgctxt "%1$s: old payment title, %2$s: new payment title"
msgid "Payment method changed from \"%1$s\" to \"%2$s\" by the subscriber."
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:545
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:552
msgid "An error occurred updating your subscription's payment method. Please contact us for assistance."
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:553
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:560
msgid "%1$sError:%2$s %3$s"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:778
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:785
msgctxt "the page title of the change payment method form"
msgid "Change payment method"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:780
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:787
msgctxt "the page title of the add payment method form"
msgid "Add payment method"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:822
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:829
msgid "Please log in to your account below to choose a new payment method for your subscription."
msgstr ""
@ -3458,53 +3458,53 @@ msgstr ""
msgid "Purchasing a subscription product requires an account. Please go to the %1$sMy Account%2$s page to login or contact us if you need assistance."
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:394
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:395
msgctxt "custom post type setting"
msgid "Add Subscription"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:395
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:396
msgctxt "custom post type setting"
msgid "Add New Subscription"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:396
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:397
msgctxt "custom post type setting"
msgid "Edit"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:397
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:398
msgctxt "custom post type setting"
msgid "Edit Subscription"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:398
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:399
msgctxt "custom post type setting"
msgid "New Subscription"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:399
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:400
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:401
msgctxt "custom post type setting"
msgid "View Subscription"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:403
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:404
msgctxt "custom post type setting"
msgid "No Subscriptions found in trash"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:404
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:405
msgctxt "custom post type setting"
msgid "Parent Subscriptions"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:407
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:408
msgid "This is where subscriptions are stored."
msgstr ""
#. translators: placeholder is a post count.
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:465
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:466
msgctxt "post status label including post count"
msgid "Active <span class=\"count\">(%s)</span>"
msgid_plural "Active <span class=\"count\">(%s)</span>"
@ -3512,7 +3512,7 @@ msgstr[0] ""
msgstr[1] ""
#. translators: placeholder is a post count.
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:467
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:468
msgctxt "post status label including post count"
msgid "Switched <span class=\"count\">(%s)</span>"
msgid_plural "Switched <span class=\"count\">(%s)</span>"
@ -3520,7 +3520,7 @@ msgstr[0] ""
msgstr[1] ""
#. translators: placeholder is a post count.
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:469
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:470
msgctxt "post status label including post count"
msgid "Expired <span class=\"count\">(%s)</span>"
msgid_plural "Expired <span class=\"count\">(%s)</span>"
@ -3528,29 +3528,29 @@ msgstr[0] ""
msgstr[1] ""
#. translators: placeholder is a post count.
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:471
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:472
msgctxt "post status label including post count"
msgid "Pending Cancellation <span class=\"count\">(%s)</span>"
msgid_plural "Pending Cancellation <span class=\"count\">(%s)</span>"
msgstr[0] ""
msgstr[1] ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:520
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:521
msgid "Variable Subscription"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:574
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:575
#: vendor/woocommerce/subscriptions-core/includes/upgrades/templates/wcs-about-2-0.php:36
msgctxt "short for documents"
msgid "Docs"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:575
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:576
msgid "Support"
msgstr ""
#. translators: placeholders are opening and closing tags. Leads to docs on upgrading WooCommerce Subscriptions
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:598
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-core-plugin.php:599
msgid "Warning! Version 2.0 is a major update to the WooCommerce Subscriptions extension. Before updating, please create a backup, update all WooCommerce extensions and test all plugins, custom code and payment gateways with version 2.0 on a staging site. %1$sLearn more about updating older versions of WooCommerce Subscriptions &raquo;%2$s"
msgstr ""
@ -3629,58 +3629,58 @@ msgstr ""
msgid "Discount"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:237
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:247
msgid "Send trial is ending notification"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:241
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:251
msgid "Send upcoming subscription expiration notification"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:245
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:255
msgid "Send upcoming renewal notification"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:261
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:271
msgid "Customer Notifications"
msgstr ""
#. translators: Link to WC Settings > Email.
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:265
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:275
msgid "To enable/disable individual notifications and customize templates, visit the <a href=\"%s\">Email settings</a>."
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:268
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:278
msgid "Enable Reminders"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:269
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:279
msgid "Send notification emails to customers for subscription renewals and expirations."
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:278
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:288
msgid "Reminder Timing"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:279
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:289
msgid "How long before the event should the notification be sent."
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:284
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:294
#: vendor/woocommerce/subscriptions-core/includes/emails/class-wcs-email-customer-notification.php:60
#: vendor/woocommerce/subscriptions-core/includes/privacy/class-wcs-privacy.php:281
msgid "N/A"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:333
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:343
msgid "WooCommerce Subscriptions: Introducing customer email notifications!"
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:334
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:344
msgid "You can now send email notifications for subscription renewals, expirations, and free trials. Go to the \"Customer Notifications\" settings section to configure when your customers receive these important updates."
msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:340
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-email-notifications.php:350
msgid "Manage settings"
msgstr ""

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit8696b4ce4243ef30c3ff87b4ec42d61a::getLoader();
return ComposerAutoloaderInit1a0806ecf77df05bfe8e09cca6dc9f00::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit8696b4ce4243ef30c3ff87b4ec42d61a
class ComposerAutoloaderInit1a0806ecf77df05bfe8e09cca6dc9f00
{
private static $loader;
@ -24,12 +24,12 @@ class ComposerAutoloaderInit8696b4ce4243ef30c3ff87b4ec42d61a
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit8696b4ce4243ef30c3ff87b4ec42d61a', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit1a0806ecf77df05bfe8e09cca6dc9f00', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit8696b4ce4243ef30c3ff87b4ec42d61a', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit1a0806ecf77df05bfe8e09cca6dc9f00', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit8696b4ce4243ef30c3ff87b4ec42d61a::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit1a0806ecf77df05bfe8e09cca6dc9f00::getInitializer($loader));
$loader->register(true);

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit8696b4ce4243ef30c3ff87b4ec42d61a
class ComposerStaticInit1a0806ecf77df05bfe8e09cca6dc9f00
{
public static $prefixLengthsPsr4 = array (
'C' =>
@ -129,9 +129,9 @@ class ComposerStaticInit8696b4ce4243ef30c3ff87b4ec42d61a
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit8696b4ce4243ef30c3ff87b4ec42d61a::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit8696b4ce4243ef30c3ff87b4ec42d61a::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit8696b4ce4243ef30c3ff87b4ec42d61a::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit1a0806ecf77df05bfe8e09cca6dc9f00::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit1a0806ecf77df05bfe8e09cca6dc9f00::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit1a0806ecf77df05bfe8e09cca6dc9f00::$classMap;
}, null, ClassLoader::class);
}

View File

@ -156,17 +156,17 @@
},
{
"name": "woocommerce/subscriptions-core",
"version": "7.8.0",
"version_normalized": "7.8.0.0",
"version": "7.9.0",
"version_normalized": "7.9.0.0",
"source": {
"type": "git",
"url": "https://github.com/Automattic/woocommerce-subscriptions-core.git",
"reference": "14e7b3d5df82a0f4d4942b8119e85087e4863a65"
"reference": "36629b90e52bf1137fd4f7580414cea7e42ce920"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/14e7b3d5df82a0f4d4942b8119e85087e4863a65",
"reference": "14e7b3d5df82a0f4d4942b8119e85087e4863a65",
"url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/36629b90e52bf1137fd4f7580414cea7e42ce920",
"reference": "36629b90e52bf1137fd4f7580414cea7e42ce920",
"shasum": ""
},
"require": {
@ -179,7 +179,7 @@
"woocommerce/woocommerce-sniffs": "0.1.0",
"yoast/phpunit-polyfills": "1.1.0"
},
"time": "2024-12-16T23:11:09+00:00",
"time": "2025-01-10T00:22:55+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.8.0",
"source": "https://github.com/Automattic/woocommerce-subscriptions-core/tree/7.9.0",
"issues": "https://github.com/Automattic/woocommerce-subscriptions-core/issues"
},
"install-path": "../woocommerce/subscriptions-core"

View File

@ -1,9 +1,9 @@
<?php return array(
'root' => array(
'name' => 'woocommerce/woocommerce-subscriptions',
'pretty_version' => 'dev-release/7.0.0',
'version' => 'dev-release/7.0.0',
'reference' => '71fd6cf0194bb9921cb70197177e77436a8fe3d8',
'pretty_version' => 'dev-release/7.1.0',
'version' => 'dev-release/7.1.0',
'reference' => '4cd67267efc98d376b5db58714feb586f8d2be41',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -32,18 +32,18 @@
),
),
'woocommerce/subscriptions-core' => array(
'pretty_version' => '7.8.0',
'version' => '7.8.0.0',
'reference' => '14e7b3d5df82a0f4d4942b8119e85087e4863a65',
'pretty_version' => '7.9.0',
'version' => '7.9.0.0',
'reference' => '36629b90e52bf1137fd4f7580414cea7e42ce920',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../woocommerce/subscriptions-core',
'aliases' => array(),
'dev_requirement' => false,
),
'woocommerce/woocommerce-subscriptions' => array(
'pretty_version' => 'dev-release/7.0.0',
'version' => 'dev-release/7.0.0',
'reference' => '71fd6cf0194bb9921cb70197177e77436a8fe3d8',
'pretty_version' => 'dev-release/7.1.0',
'version' => 'dev-release/7.1.0',
'reference' => '4cd67267efc98d376b5db58714feb586f8d2be41',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),

View File

@ -1,5 +1,13 @@
*** WooCommerce Subscriptions Core Changelog ***
= 7.9.0 - 2025-01-10 =
* Add - Compatibility with WooCommerce's new preview email feature introduced in 9.6.
* Fix - Prevent payment gateways that complete Change Payment requests asynchronously from blocking future attempts to update payment methods for all subscriptions.
* Fix - Resolved an issue that could lead to undefined variable when attempting to send a customer notification email with no order.
* Fix - Prevents the customer's postal code being used as their billing city in the current session, following a change to payment details.
* Dev - Use the subscription's customer ID during the `wcs_can_user_renew_early()` function call when sending customer notification emails.
* Dev - Fix PHP deprecated warnings caused by calling esc_url with null.
= 7.8.0 - 2024-12-16 =
* Fix - Prevent failing non-recent renewal order from suspending the subscription and marking the most recent renewal order as failed.
* Fix - Use block theme-styled buttons for subscription and related-orders actions on My Account pages.

View File

@ -294,7 +294,7 @@ class WC_Subscriptions_Change_Payment_Gateway {
$subscription_billing_country = $subscription->get_billing_country();
$subscription_billing_state = $subscription->get_billing_state();
$subscription_billing_postcode = $subscription->get_billing_postcode();
$subscription_billing_city = $subscription->get_billing_postcode();
$subscription_billing_city = $subscription->get_billing_city();
// Set customer location to order location
if ( $subscription_billing_country ) {
@ -314,6 +314,10 @@ class WC_Subscriptions_Change_Payment_Gateway {
WC()->customer->$setter( $subscription_billing_city );
}
// For each new change payment request, make sure we delete the delayed update payment method meta if it exists.
$subscription->delete_meta_data( '_delayed_update_payment_method_all' );
$subscription->save_meta_data();
// Update payment method
$new_payment_method = wc_clean( $_POST['payment_method'] );
$notice = $subscription->has_payment_gateway() ? __( 'Payment method updated.', 'woocommerce-subscriptions' ) : __( 'Payment method added.', 'woocommerce-subscriptions' );
@ -434,6 +438,9 @@ class WC_Subscriptions_Change_Payment_Gateway {
continue;
}
// Clear any stale _delayed_update_payment_method_all meta existing on the users other subscriptions if it exists.
$user_subscription->delete_meta_data( '_delayed_update_payment_method_all' );
self::update_payment_method( $user_subscription, $new_payment_method, $payment_meta_table );
$user_subscription->set_requires_manual_renewal( false );

View File

@ -16,7 +16,7 @@ class WC_Subscriptions_Core_Plugin {
* The version of subscriptions-core library.
* @var string
*/
protected $library_version = '7.8.0'; // WRCS: DEFINED_VERSION.
protected $library_version = '7.9.0'; // WRCS: DEFINED_VERSION.
/**
* The subscription scheduler instance.
@ -200,6 +200,7 @@ class WC_Subscriptions_Core_Plugin {
WCS_My_Account_Payment_Methods::init();
WCS_My_Account_Auto_Renew_Toggle::init();
new WCS_Deprecated_Filter_Hooks();
new WC_Subscriptions_Email_Preview();
// On some loads the WC_Query doesn't exist. To avoid a fatal, only load the WCS_Query class when it exists.
if ( class_exists( 'WC_Query' ) ) {

View File

@ -20,6 +20,19 @@ class WC_Subscriptions_Email_Notifications {
*/
public static $switch_setting_string = '_customer_notifications_enabled';
/**
* List of subscription notification email classes.
*
* @var array
*/
public static $email_classes = [
'WCS_Email_Customer_Notification_Manual_Trial_Expiration' => true,
'WCS_Email_Customer_Notification_Auto_Trial_Expiration' => true,
'WCS_Email_Customer_Notification_Manual_Renewal' => true,
'WCS_Email_Customer_Notification_Auto_Renewal' => true,
'WCS_Email_Customer_Notification_Subscription_Expiration' => true,
];
/**
* Init.
*/
@ -107,12 +120,9 @@ class WC_Subscriptions_Email_Notifications {
* Add Subscriptions notifications' email classes.
*/
public static function add_emails( $email_classes ) {
$email_classes['WCS_Email_Customer_Notification_Auto_Trial_Expiration'] = new WCS_Email_Customer_Notification_Auto_Trial_Expiration();
$email_classes['WCS_Email_Customer_Notification_Manual_Trial_Expiration'] = new WCS_Email_Customer_Notification_Manual_Trial_Expiration();
$email_classes['WCS_Email_Customer_Notification_Subscription_Expiration'] = new WCS_Email_Customer_Notification_Subscription_Expiration();
$email_classes['WCS_Email_Customer_Notification_Manual_Renewal'] = new WCS_Email_Customer_Notification_Manual_Renewal();
$email_classes['WCS_Email_Customer_Notification_Auto_Renewal'] = new WCS_Email_Customer_Notification_Auto_Renewal();
foreach ( self::$email_classes as $email_class => $_ ) {
$email_classes[ $email_class ] = new $email_class();
}
return $email_classes;
}

View File

@ -11,6 +11,24 @@
*/
class WC_Subscriptions_Email {
/**
* List of all core subscription email classes.
*
* @var array
*/
public static $email_classes = [
'WCS_Email_New_Renewal_Order' => true,
'WCS_Email_New_Switch_Order' => true,
'WCS_Email_Processing_Renewal_Order' => true,
'WCS_Email_Completed_Renewal_Order' => true,
'WCS_Email_Customer_On_Hold_Renewal_Order' => true,
'WCS_Email_Completed_Switch_Order' => true,
'WCS_Email_Customer_Renewal_Invoice' => true,
'WCS_Email_Cancelled_Subscription' => true,
'WCS_Email_Expired_Subscription' => true,
'WCS_Email_On_Hold_Subscription' => true,
];
/**
* Bootstraps the class and hooks required actions & filters.
*
@ -36,16 +54,9 @@ class WC_Subscriptions_Email {
* @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.4
*/
public static function add_emails( $email_classes ) {
$email_classes['WCS_Email_New_Renewal_Order'] = new WCS_Email_New_Renewal_Order();
$email_classes['WCS_Email_New_Switch_Order'] = new WCS_Email_New_Switch_Order();
$email_classes['WCS_Email_Processing_Renewal_Order'] = new WCS_Email_Processing_Renewal_Order();
$email_classes['WCS_Email_Completed_Renewal_Order'] = new WCS_Email_Completed_Renewal_Order();
$email_classes['WCS_Email_Customer_On_Hold_Renewal_Order'] = new WCS_Email_Customer_On_Hold_Renewal_Order();
$email_classes['WCS_Email_Completed_Switch_Order'] = new WCS_Email_Completed_Switch_Order();
$email_classes['WCS_Email_Customer_Renewal_Invoice'] = new WCS_Email_Customer_Renewal_Invoice();
$email_classes['WCS_Email_Cancelled_Subscription'] = new WCS_Email_Cancelled_Subscription();
$email_classes['WCS_Email_Expired_Subscription'] = new WCS_Email_Expired_Subscription();
$email_classes['WCS_Email_On_Hold_Subscription'] = new WCS_Email_On_Hold_Subscription();
foreach ( self::$email_classes as $email_class => $_ ) {
$email_classes[ $email_class ] = new $email_class();
}
return $email_classes;
}
@ -306,11 +317,17 @@ class WC_Subscriptions_Email {
public static function subscription_details( $subscriptions, $order = null, $sent_to_admin = false, $plain_text = false, $skip_my_account_link = false ) {
$template = ( $plain_text ) ? 'emails/plain/subscription-info.php' : 'emails/subscription-info.php';
if ( ! is_array( $subscriptions ) ) {
$subscriptions = [ $subscriptions ];
}
$order = ! $order && ! empty( $subscriptions ) ? reset( $subscriptions )->get_parent() : $order;
wc_get_template(
$template,
array(
'order' => ! $order ? $subscription->get_parent() : $order,
'subscriptions' => is_array( $subscriptions ) ? $subscriptions : [ $subscriptions ],
'order' => $order,
'subscriptions' => $subscriptions,
'is_admin_email' => $sent_to_admin,
'skip_my_account_link' => $skip_my_account_link,
),

View File

@ -0,0 +1,207 @@
<?php
/**
* Subscriptions Email Preview Class
*/
class WC_Subscriptions_Email_Preview {
/**
* The email being previewed
*
* @var string
*/
private $email_type;
/**
* Constructor.
*/
public function __construct() {
add_filter( 'woocommerce_prepare_email_for_preview', [ $this, 'prepare_email_for_preview' ] );
}
/**
* Prepare subscription email dummy data for preview.
*
* @param WC_Email $email The email object.
*
* @return WC_Email
*/
public function prepare_email_for_preview( $email ) {
$this->email_type = get_class( $email );
if ( ! $this->is_subscription_email() ) {
return $email;
}
$this->set_up_filters();
switch ( $this->email_type ) {
case 'WCS_Email_New_Switch_Order':
case 'WCS_Email_Completed_Switch_Order':
$email->subscriptions = [ $this->get_dummy_subscription() ];
break;
case 'WCS_Email_Cancelled_Subscription':
case 'WCS_Email_Expired_Subscription':
case 'WCS_Email_On_Hold_Subscription':
case 'WCS_Email_Customer_Notification_Auto_Trial_Expiration':
case 'WCS_Email_Customer_Notification_Manual_Trial_Expiration':
case 'WCS_Email_Customer_Notification_Subscription_Expiration':
case 'WCS_Email_Customer_Notification_Manual_Renewal':
case 'WCS_Email_Customer_Notification_Auto_Renewal':
$email->set_object( $this->get_dummy_subscription() );
break;
}
add_filter( 'woocommerce_mail_content', [ $this, 'clean_up_filters' ] );
return $email;
}
/**
* Get a dummy subscription for use in preview emails.
*
* @return WC_Subscription
*/
private function get_dummy_subscription() {
$subscription = new WC_Subscription();
$product = $this->get_dummy_product();
$subscription->add_product( $product, 2 );
$subscription->set_id( 12346 );
$subscription->set_customer_id( 1 );
$subscription->set_date_created( gmdate( 'Y-m-d H:i:s', strtotime( '-1 month' ) ) );
$subscription->set_currency( 'USD' );
$subscription->set_total( 100 );
$subscription->set_billing_period( 'month' );
$subscription->set_billing_interval( 1 );
$subscription->set_start_date( gmdate( 'Y-m-d H:i:s', strtotime( '-1 month' ) ) );
$subscription->set_trial_end_date( gmdate( 'Y-m-d H:i:s', strtotime( '+1 week' ) ) );
$subscription->set_next_payment_date( gmdate( 'Y-m-d H:i:s', strtotime( '+1 week' ) ) );
$subscription->set_end_date( gmdate( 'Y-m-d H:i:s', strtotime( '+1 month' ) ) );
$address = self::get_dummy_address();
$subscription->set_billing_address( $address );
$subscription->set_shipping_address( $address );
/**
* Filter the dummy subscription object used in email previews.
*
* @param WC_Subscription $subscription The dummy subscription object.
* @param string $email_type The email type being previewed.
*/
return apply_filters( 'woocommerce_subscriptions_email_preview_dummy_subscription', $subscription, $this->email_type );
}
/**
* Get a dummy product for use when previewing subscription emails.
*
* @return WC_Product
*/
private function get_dummy_product() {
$product = new WC_Product();
$product->set_name( 'Dummy Subscription' );
$product->set_price( 25 );
/**
* Filter the dummy subscription product object used in email previews.
*
* @param WC_Product $product The dummy product object.
* @param string $email_type The email type being previewed.
*/
return apply_filters( 'woocommerce_subscriptions_email_preview_dummy_product', $product, $this->email_type );
}
/**
* Get a dummy address used when previewing subscription emails.
*
* @return array
*/
private function get_dummy_address() {
$address = [
'first_name' => 'John',
'last_name' => 'Doe',
'company' => 'Company',
'email' => 'john@company.com',
'phone' => '555-555-5555',
'address_1' => '123 Fake Street',
'city' => 'Faketown',
'postcode' => '12345',
'country' => 'US',
'state' => 'CA',
];
/**
* Filter the dummy address used in email previews.
*
* @param array $address The dummy address.
* @param string $email_type The email type being previewed.
*/
return apply_filters( 'woocommerce_subscriptions_email_preview_dummy_address', $address, $this->email_type );
}
/**
* Check if the email being previewed is a subscription email.
*
* @return bool
*/
private function is_subscription_email() {
return isset( WC_Subscriptions_Email::$email_classes[ $this->email_type ] ) || isset( WC_Subscriptions_Email_Notifications::$email_classes[ $this->email_type ] );
}
/**
* Set up filters for previewing emails.
*/
private function set_up_filters() {
// Filter the last order date created for a subscription to be displayed in the Cancelled Subscription email.
add_filter( 'woocommerce_subscription_get_last_order_date_created_date', [ $this, 'mock_last_order_date_created' ], 10, 2 );
// For the purpose of previewing an email, force the subscription to be early renewable if the feature is enabled.
add_filter( 'woocommerce_subscriptions_can_user_renew_early', [ $this, 'allow_early_renewals_during_preview' ], 10, 3 );
}
/**
* Clean up filters at the end of previewing emails.
*
* @param string $preview_content The email content.
*
* @return string
*/
public function clean_up_filters( $preview_content ) {
remove_filter( 'woocommerce_subscription_get_last_order_date_created_date', [ $this, 'mock_last_order_date_created' ] );
remove_filter( 'woocommerce_subscriptions_can_user_renew_early', [ $this, 'allow_early_renewals_during_preview' ] );
return $preview_content;
}
/**
* Mock the last order date created for a subscription to the current date.
*
* @param string $date The date.
*
* @return string
*/
public function mock_last_order_date_created( $date, $subscription ) {
if ( is_a( $subscription, 'WC_Subscription' ) && 12346 === $subscription->get_id() && 1 === $subscription->get_customer_id() ) {
return gmdate( 'Y-m-d H:i:s' );
}
return $date;
}
/**
* Allow early renewals for previewing emails.
*
* @param bool $can_renew_early Whether the subscription can be renewed early.
* @param WC_Subscription $subscription The subscription.
* @param int $user_id The user ID.
*
* @return bool
*/
public function allow_early_renewals_during_preview( $can_renew_early, $subscription, $user_id ) {
if ( 1 === $user_id ) {
return true;
}
return $can_renew_early;
}
}

View File

@ -118,7 +118,7 @@ class WCS_Email_Customer_Notification extends WC_Email {
public function get_content_html() {
$subscription = $this->object;
if ( wcs_can_user_renew_early( $subscription )
if ( wcs_can_user_renew_early( $subscription, $subscription->get_customer_id() )
&& $subscription->payment_method_supports( 'subscription_date_changes' )
&& WCS_Early_Renewal_Manager::is_early_renewal_enabled()
&& WCS_Manual_Renewal_Manager::is_manual_renewal_enabled()
@ -164,7 +164,7 @@ class WCS_Email_Customer_Notification extends WC_Email {
public function get_content_plain() {
$subscription = $this->object;
if ( wcs_can_user_renew_early( $subscription )
if ( wcs_can_user_renew_early( $subscription, $subscription->get_customer_id() )
&& $subscription->payment_method_supports( 'subscription_date_changes' )
&& WCS_Early_Renewal_Manager::is_early_renewal_enabled()
&& WCS_Manual_Renewal_Manager::is_manual_renewal_enabled()

View File

@ -65,7 +65,7 @@ function wcs_get_edit_post_link( $post_id ) {
$object = wc_get_order( $post_id ); // works for both WC Order and WC Subscription objects.
if ( ! $object || ! in_array( $object->get_type(), array( 'shop_order', 'shop_subscription' ), true ) ) {
return;
return '';
}
return apply_filters( 'get_edit_post_link', $object->get_edit_order_url(), $post_id, '' );

View File

@ -123,11 +123,12 @@ function wcs_cart_contains_failed_renewal_order_payment() {
}
/**
* Get the subscription/s to which a resubscribe order relates.
* Get the subscription/s to which a renewal order relates.
*
* @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0
*
* @param WC_Order|int $order The WC_Order object or ID of a WC_Order order.
* @return WC_Subscription[] Subscription details in post_id => WC_Subscription form.
* @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0
*/
function wcs_get_subscriptions_for_renewal_order( $order ) {
return wcs_get_subscriptions_for_order( $order, array( 'order_type' => 'renewal' ) );

View File

@ -6,5 +6,5 @@
* Author: Automattic
* Author URI: https://woocommerce.com/
* Requires WP: 5.6
* Version: 7.8.0
* Version: 7.9.0
*/

View File

@ -5,7 +5,7 @@
* Description: Sell products and services with recurring payments in your WooCommerce Store.
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Version: 7.0.0
* Version: 7.1.0
* 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 = '7.0.0'; // WRCS: DEFINED_VERSION.
public static $version = '7.1.0'; // WRCS: DEFINED_VERSION.
/** @var string */
public static $wc_minimum_supported_version = '7.7';