Skip to content

Commit

Permalink
Updates to 7.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
WooCommerce committed Feb 14, 2025
1 parent 1d59fa1 commit 147748f
Show file tree
Hide file tree
Showing 150 changed files with 1,467 additions and 940 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.11
19 changes: 19 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
*** WooCommerce Subscriptions Changelog ***

2025-02-13 - version 7.2.1
* Fix: Revert a change released in 7.2.0 which triggered the "woocommerce_cart_item_name" filter with the wrong number of parameters.
* Dev: Update subscriptions-core to 8.0.1.

2025-02-13 - version 7.2.0
* Fix: In the system status report, show correct icon in the Cache Update Failures section when the total failures is 0.
* Fix: Recommend WooPayments when there is no available payment gateway.
* Fix: Safeguards added to the Subscriptions Totals template used in the My Account area, to guard against fatal errors that could arise in unusual conditions.
* Fix: Correctly load product names with HTML on the cart and checkout shipping rates.
* Fix: Improve our admin notice handling to ensure notices are displayed to the intended admin user.
* Fix: Improve protections around the pending renewal order-creation process, to prevent uncaught exceptions and other errors from breaking the subscription editor.
* Fix: Prevent unnecessary subscription object lookups on non-subscription admin pages when global $post is set.
* Fix: After enabling the Customer Notification feature or changing the reminder timing setting, ensure notifications are correctly scheduled for all subscriptions with pending cancellation status.
* Update: Improve performance of displaying recurring coupon limits in the admin coupon list table by optimizing coupon object retrieval.
* Update: Display the subscription items table in all customer notification emails.
* Update: Subscription notes for unsent customer notification emails now only occurs if WCS_DEBUG is enabled.
* Dev: Introduces a new `woocommerce_subscription_valid_customer_notification_types` filter to modify which notification types are scheduled in Action Scheduler.
* Dev: Update subscriptions-core to 8.0.0.

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.
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/reports/class-wcs-report-cache-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public function add_system_status_info( $data ) {
'label' => 'Cache Update Failures',
/* translators: %d refers to the number of times we have detected cache update failures */
'note' => sprintf( _n( '%d failures', '%d failure', $failures, 'woocommerce-subscriptions' ), $failures ),
'success' => 0 === $failures,
'success' => 0 === (int)$failures,
),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ public function get_data( $args = array() ) {

// Remove this class from the list of classes WC updates on shutdown. Introduced in WC 3.7
if ( ! wcs_is_woocommerce_pre( '3.7' ) ) {
unset( WC_Admin_Report::$transients_to_update[ strtolower( get_class( $this ) ) ] );
$class_name = strtolower( get_class( $this ) );
unset( WC_Admin_Report::$transients_to_update[ $class_name ] );
}
}
}
Expand Down
28 changes: 19 additions & 9 deletions includes/class-wcs-limited-recurring-coupon-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,33 @@ public static function save_coupon_fields( $id ) {
* Get the number of renewals for a limited coupon.
*
* @since 4.0.0
* @param string $code The coupon code.
* @param string|WC_Coupon $coupon The coupon or coupon code.
* @return false|int False for non-recurring coupons, or the limit number for recurring coupons.
* A value of 0 is for unlimited usage.
*/
public static function get_coupon_limit( $code ) {
if ( wcs_is_woocommerce_pre( '3.2' ) ) {
public static function get_coupon_limit( $coupon ) {
// If we have a coupon code, attempt to get the coupon object.
if ( is_string( $coupon ) ) {
$coupon = new WC_Coupon( $coupon );
}

if ( ! $coupon instanceof WC_Coupon ) {
return false;
}

// Retrieve the coupon data.
$coupon = new WC_Coupon( $code );
$coupon_type = $coupon->get_discount_type();

// If we have a virtual coupon, attempt to get the original coupon.
if ( WC_Subscriptions_Coupon::is_renewal_cart_coupon( $coupon_type ) ) {
$coupon = WC_Subscriptions_Coupon::map_virtual_coupon( $code );
$coupon = WC_Subscriptions_Coupon::map_virtual_coupon( $coupon->get_code() );
$coupon_type = $coupon->get_discount_type();
}

$limited = $coupon->get_meta( self::$coupons_renewals );
if ( ! WC_Subscriptions_Coupon::is_recurring_coupon( $coupon_type ) ) {
return false;
}

return WC_Subscriptions_Coupon::is_recurring_coupon( $coupon_type ) ? intval( $limited ) : false;
return intval( $coupon->get_meta( self::$coupons_renewals ) );
}

/**
Expand Down Expand Up @@ -266,11 +271,16 @@ public static function check_coupon_usages( $subscription ) {
* @param int $id The coupon ID.
*/
public static function add_limit_to_list_table( $column_name, $id ) {
global $the_coupon;

if ( 'usage' !== $column_name ) {
return;
}

$limit = self::get_coupon_limit( wc_get_coupon_code_by_id( $id ) );
// Confirm the global coupon object is the one we're looking for, otherwise fetch it.
$coupon = empty( $the_coupon ) || $the_coupon->get_id() !== $id ? new WC_Coupon( $id ) : $the_coupon;
$limit = self::get_coupon_limit( $coupon );

if ( false === $limit ) {
return;
}
Expand Down
Loading

0 comments on commit 147748f

Please sign in to comment.