Skip to content

Commit

Permalink
Updates to 6.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WooCommerce committed Nov 14, 2024
1 parent b811acf commit 8b04330
Show file tree
Hide file tree
Showing 84 changed files with 4,862 additions and 667 deletions.
2 changes: 1 addition & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"plugins": [
"https://downloads.wordpress.org/plugin/woocommerce.zip",
"https://downloads.wordpress.org/plugin/email-log.zip",
"https://github.com/woocommerce/woocommerce-gateway-dummy/releases/download/1.0.8/woocommerce-gateway-dummy.zip",
"https://github.com/woocommerce/woocommerce-gateway-dummy/releases/download/1.0.9/woocommerce-gateway-dummy.zip",
".",
"./tests/e2e/test-configuration-plugin"
],
Expand Down
5 changes: 5 additions & 0 deletions bin/install-wp-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ install_db() {
mysqladmin create $DB_NAME $MYSQLADMIN_FLAGS
}

install_legacy_rest_api() {
wp plugin install https://downloads.wordpress.org/plugin/woocommerce-legacy-rest-api.1.0.4.zip --activate
}

install_woocommerce() {
WC_INSTALL_EXTRA=''
INSTALLED_WC_VERSION=$(wp plugin get woocommerce --field=version)
Expand Down Expand Up @@ -202,4 +206,5 @@ install_wp
install_db
configure_wp
install_test_suite
install_legacy_rest_api
install_woocommerce
11 changes: 11 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
*** WooCommerce Subscriptions Changelog ***

2024-11-14 - version 6.9.0
* Add: New Customer Notification feature - sends reminder emails for upcoming subscription renewals, trials ending, and subscription expirations.
* Fix: Prevent adding products to the cart if a subscription renewal is already present.
* Update: Improved performance of wcs_get_subscription() when querying by product and customer or order.
* Update: Improved performance when checking limited subscription product availability.
* Update: Deprecate upgrading from versions of WooCommerce Subscriptions prior to 3.0.0 (released Jan 2020).
* Dev: Minor refactoring of `init` method in `WC_Subscriptions_Upgrader` class.
* Dev: Introduce the filter `woocommerce_subscriptions_synced_first_renewal_payment_timestamp` to enable plugins to modify the first renewal date of synced subscriptions.
* Dev: Update `get_post_meta()` calls to fetch product meta using CRUD getters.
* Dev: Update subscriptions-core to 7.7.1

2024-10-14 - version 6.8.0
* Fix: Restore Retry icon in Orders table for HPOS-enabled stores.
* Fix: Correctly updates a subscription status to `cancelled` during a payment failure call when the current status is `pending-cancel`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public function get_retries( $args = array(), $return = 'objects' ) {
'limit' => -1,
) );

// We need to keep this call to `get_posts` since this is a custom post type (`payment_retry`), not a custom order type.
$retry_post_ids = get_posts( array(
'posts_per_page' => $args['limit'],
'post_type' => self::$post_type,
Expand Down
15 changes: 7 additions & 8 deletions includes/payment-retry/emails/class-wcs-retry-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ class WCS_Retry_Email {
* @since 2.1
*/
public static function init() {
add_action( 'woocommerce_email_classes', array( __CLASS__, 'add_emails' ), 12, 1 );

add_action( 'woocommerce_email_classes', __CLASS__ . '::add_emails', 12, 1 );
add_action( 'woocommerce_subscriptions_after_apply_retry_rule', array( __CLASS__, 'send_email' ), 0, 2 );

add_action( 'woocommerce_subscriptions_after_apply_retry_rule', __CLASS__ . '::send_email', 0, 2 );
add_action( 'woocommerce_order_status_failed', array( __CLASS__, 'maybe_detach_email' ), 9 );

add_action( 'woocommerce_order_status_failed', __CLASS__ . '::maybe_detach_email', 9 );

add_action( 'woocommerce_order_status_changed', __CLASS__ . '::maybe_reattach_email', 100, 3 );
add_action( 'woocommerce_order_status_changed', array( __CLASS__, 'maybe_reattach_email' ), 100, 3 );
}

/**
Expand All @@ -47,8 +46,8 @@ public static function add_emails( $email_classes ) {
*
* Attached to 'woocommerce_subscriptions_after_apply_retry_rule' with a low priority.
*
* @param WCS_Retry_Rule The retry rule applied.
* @param WC_Order The order to which the retry rule was applied.
* @param WCS_Retry_Rule $retry_rule The retry rule applied.
* @param WC_Order $last_order The order to which the retry rule was applied.
* @since 2.1
*/
public static function send_email( $retry_rule, $last_order ) {
Expand All @@ -60,7 +59,7 @@ public static function send_email( $retry_rule, $last_order ) {
$email_class = $retry_rule->get_email_template( $recipient );
if ( class_exists( $email_class ) ) {
$email = new $email_class();
$email->trigger( wcs_get_objects_property( $last_order, 'id' ), $last_order );
$email->trigger( $last_order->get_id(), $last_order );
}
}
}
Expand Down
17 changes: 6 additions & 11 deletions includes/switching/class-wc-subscriptions-switcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ public static function update_shipping_methods( $subscription, $recurring_cart )
WC_Subscriptions_Checkout::add_shipping( $subscription, $recurring_cart );

// Now update subscription object order_shipping to reflect updated values so it doesn't stay 0
$subscription->order_shipping = get_post_meta( $subscription->get_id(), '_order_shipping', true );
$subscription->order_shipping = $subscription->get_meta( '_order_shipping', true );
}

/**
Expand Down Expand Up @@ -2460,12 +2460,10 @@ public static function subscription_switch_autocomplete( $new_order_status, $ord
* @deprecated 2.1
*/
public static function maybe_set_payment_method( $payment_processing_result, $order_id ) {

_deprecated_function( __METHOD__, '2.1', __CLASS__ . '::maybe_set_payment_method_after_switch( $order )' );

if ( wcs_order_contains_switch( $order_id ) && false != get_post_meta( $order_id, '_paid_date', true ) ) {

$order = wc_get_order( $order_id );
$order = wc_get_order( $order_id );
if ( wcs_order_contains_switch( $order_id ) && false !== (bool) $order->get_meta( '_paid_date', true ) ) {
self::maybe_set_payment_method_after_switch( $order );
}

Expand Down Expand Up @@ -2808,13 +2806,10 @@ public static function get_first_payment_date( $next_payment_date, $subscription
_deprecated_function( __METHOD__, '2.0' );

$subscription = wcs_get_subscription_from_key( $subscription_key );

if ( $subscription->has_status( 'active' ) && $subscription->get_parent_id() && wcs_order_contains_switch( $subscription->get_parent_id() ) && 1 >= $subscription->get_payment_count() ) {

$first_payment_timestamp = get_post_meta( $subscription->get_parent_id(), '_switched_subscription_first_payment_timestamp', true );

if ( 0 != $first_payment_timestamp ) {
$next_payment_date = ( 'mysql' == $type ) ? gmdate( 'Y-m-d H:i:s', $first_payment_timestamp ) : $first_payment_timestamp;
$first_payment_timestamp = (int) $subscription->get_meta( '_switched_subscription_first_payment_timestamp', true );
if ( 0 !== $first_payment_timestamp ) {
$next_payment_date = ( 'mysql' === $type ) ? gmdate( 'Y-m-d H:i:s', $first_payment_timestamp ) : $first_payment_timestamp;
}
}

Expand Down
Loading

0 comments on commit 8b04330

Please sign in to comment.