Updates to 7.0.0

This commit is contained in:
WooCommerce
2024-12-18 10:16:31 +00:00
parent 8c0d9ae33c
commit 60a125d936
38 changed files with 139 additions and 731 deletions

View File

@@ -1,5 +1,13 @@
*** WooCommerce Subscriptions Changelog *** *** WooCommerce Subscriptions Changelog ***
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.
* Fix: Subscription totals not properly updating when customers remove items via the My Account > View Subscription page on some stores with caching enabled.
* Fix: Resolved unexpected errors during the renewal process when a subscription contains metadata with key "id".
* Update: Changed the link on the order thank-you page to take customers directly to their "My Account > Subscriptions" page.
* Dev: Update subscriptions-core to 7.8.0
2024-11-27 - version 6.9.1 2024-11-27 - version 6.9.1
* Fix: Resolved compatibility issues with WordPress 6.7 caused by translating strings too early. * Fix: Resolved compatibility issues with WordPress 6.7 caused by translating strings too early.
* Dev: Update subscriptions-core to 7.7.2 * Dev: Update subscriptions-core to 7.7.2

View File

@@ -223,32 +223,4 @@ class WCS_Admin_Reports {
WC_Tracks::record_event( $reports[ $name ], $properties ); WC_Tracks::record_event( $reports[ $name ], $properties );
} }
} }
/**
* If we hit one of our reports in the WC get_report function, change the path to our dir.
*
* @param string $report_path the parth to the report.
* @param string $name the name of the report.
* @param string $class the class of the report.
*
* @return string path to the report template.
* @since 2.1
* @deprecated in favor of autoloading
* @access private
*/
public static function initialize_reports_path( $report_path, $name, $class ) {
_deprecated_function( __METHOD__, '2.4.0' );
if ( in_array( strtolower( $class ), array(
'wc_report_subscription_events_by_date',
'wc_report_upcoming_recurring_revenue',
'wc_report_retention_rate',
'wc_report_subscription_by_product',
'wc_report_subscription_by_customer',
'wc_report_subscription_payment_retry',
) ) ) {
$report_path = dirname( __FILE__ ) . '/reports/classwcsreport' . $name . '.php';
}
return $report_path;
}
} }

View File

@@ -1,20 +0,0 @@
<?php
/**
* Subscriptions Admin Report - Retention Rate
*
* Find the number of periods between when each subscription is created and ends or ended
* then plot all subscriptions using this data to provide a curve of retention rates.
*
* @package WooCommerce Subscriptions
* @subpackage WC_Subscriptions_Admin_Reports
* @category Class
* @author Prospress
* @since 2.1
* @deprecated in favor of WCS_Report_Retention_Rate
*/
class WC_Report_Retention_Rate extends WCS_Report_Retention_Rate {
public function __construct() {
wcs_deprecated_function( __CLASS__, '2.4.0', get_parent_class( __CLASS__ ) );
}
}

View File

@@ -1,19 +0,0 @@
<?php
/**
* Subscriptions Admin Report - Subscriptions by customer
*
* Creates the subscription admin reports area.
*
* @package WooCommerce Subscriptions
* @subpackage WC_Subscriptions_Admin_Reports
* @category Class
* @author Prospress
* @since 2.1
* @deprecated in favor of WCS_Report_Subscription_By_Customer
*/
class WC_Report_Subscription_By_Customer extends WCS_Report_Subscription_By_Customer {
public function __construct() {
wcs_deprecated_function( __CLASS__, '2.4.0', get_parent_class( __CLASS__ ) );
parent::__construct();
}
}

View File

@@ -1,20 +0,0 @@
<?php
/**
* Subscriptions Admin Report - Subscriptions by product
*
* Creates the subscription admin reports area.
*
* @package WooCommerce Subscriptions
* @subpackage WC_Subscriptions_Admin_Reports
* @category Class
* @author Prospress
* @since 2.1
* @deprecated In favor of WCS_Report_Subscription_By_Product
*/
class WC_Report_Subscription_By_Product extends WCS_Report_Subscription_By_Product {
public function __construct() {
wcs_deprecated_function( __CLASS__, '2.4.0', get_parent_class( __CLASS__ ) );
parent::__construct();
}
}

View File

@@ -1,19 +0,0 @@
<?php
/**
* Subscriptions Admin Report - Subscription Events by Date
*
* Display important historical data for subscription revenue and events, like switches and cancellations.
*
* @package WooCommerce Subscriptions
* @subpackage WC_Subscriptions_Admin_Reports
* @category Class
* @author Prospress
* @since 2.1
* @deprecated In favor of WCS_Report_Subscription_Events_By_Date
*/
class WC_Report_Subscription_Events_By_Date extends WCS_Report_Subscription_Events_By_Date {
public function __construct() {
wcs_deprecated_function( __CLASS__, '2.4.0', get_parent_class( __CLASS__ ) );
}
}

View File

@@ -1,18 +0,0 @@
<?php
/**
* Subscriptions Admin Report - Subscription Events by Date
*
* Creates the subscription admin reports area.
*
* @package WooCommerce Subscriptions
* @subpackage WC_Subscriptions_Admin_Reports
* @category Class
* @author Prospress
* @since 2.1
* @deprecated In favor of WCS_Report_Subscription_Payment_Retry
*/
class WC_Report_Subscription_Payment_Retry extends WCS_Report_Subscription_Payment_Retry {
public function __construct() {
wcs_deprecated_function( __CLASS__, '2.4.0', get_parent_class( __CLASS__ ) );
}
}

View File

@@ -1,19 +0,0 @@
<?php
/**
* Subscriptions Admin Report - Upcoming Recurring Revenue
*
* Display the renewal order count and revenue that will be processed for all currently active subscriptions
* for a given period of time in the future.
*
* @package WooCommerce Subscriptions
* @subpackage WC_Subscriptions_Admin_Reports
* @category Class
* @author Prospress
* @since 2.1
* @deprecated In favor of WCS_Report_Upcoming_Recurring_Revenue
*/
class WC_Report_Upcoming_Recurring_Revenue extends WCS_Report_Upcoming_Recurring_Revenue {
public function __construct() {
wcs_deprecated_function( __CLASS__, '2.4.0', get_parent_class( __CLASS__ ) );
}
}

View File

@@ -707,78 +707,4 @@ class WC_REST_Subscriptions_V1_Controller extends WC_REST_Orders_V1_Controller {
$schema['properties'] += $subscriptions_schema; $schema['properties'] += $subscriptions_schema;
return $schema; return $schema;
} }
/**
* Deprecated functions
*/
/**
* Prepare subscription data for create.
*
* Now that we override WC_REST_Orders_V1_Controller::prepare_item_for_database() function,
* we no longer need to prepare these args
*
* @since 2.1
* @param stdClass $data
* @param WP_REST_Request $request Request object.
* @return stdClass
* @deprecated 2.2
*/
public function prepare_subscription_args( $data, $request ) {
wcs_deprecated_function( __METHOD__, '2.2' );
$data->billing_interval = $request['billing_interval'];
$data->billing_period = $request['billing_period'];
foreach ( array( 'start', 'trial_end', 'end', 'next_payment' ) as $date_type ) {
if ( ! empty( $request[ $date_type . '_date' ] ) ) {
$date_type_key = ( 'start' === $date_type ) ? 'date_created' : $date_type . '_date';
$data->{$date_type_key} = $request[ $date_type . '_date' ];
}
}
$data->payment_details = ! empty( $request['payment_details'] ) ? $request['payment_details'] : '';
$data->payment_method = ! empty( $request['payment_method'] ) ? $request['payment_method'] : '';
return $data;
}
/**
* Update or set the subscription schedule with the request data.
*
*
* @since 2.1
* @param WC_Subscription $subscription
* @param array $data
* @deprecated 2.2
*/
public function update_schedule( $subscription, $data ) {
wcs_deprecated_function( __METHOD__, '2.2', 'WC_REST_Subscriptions_Controller::prepare_item_for_database() now prepares the billing interval/period and dates' );
if ( isset( $data['billing_interval'] ) ) {
$subscription->set_billing_interval( absint( $data['billing_interval'] ) );
}
if ( ! empty( $data['billing_period'] ) ) {
$subscription->set_billing_period( $data['billing_period'] );
}
try {
$dates_to_update = array();
foreach ( array( 'start', 'trial_end', 'end', 'next_payment' ) as $date_type ) {
if ( isset( $data[ $date_type . '_date' ] ) ) {
$date_type_key = ( 'start' === $date_type ) ? 'date_created' : $date_type;
$dates_to_update[ $date_type_key ] = $data[ $date_type . '_date' ];
}
}
if ( ! empty( $dates_to_update ) ) {
$subscription->update_dates( $dates_to_update );
}
} catch ( Exception $e ) {
// translators: placeholder is an error message.
throw new WC_REST_Exception( 'woocommerce_rest_cannot_update_subscription_dates', sprintf( __( 'Updating subscription dates errored with message: %s', 'woocommerce-subscriptions' ), $e->getMessage() ), 400 );
}
}
} }

View File

@@ -93,8 +93,6 @@ class WCS_Autoloader extends WCS_Core_Autoloader {
if ( stripos( $class, 'switch' ) !== false || 'wcs_add_cart_item' === $class ) { if ( stripos( $class, 'switch' ) !== false || 'wcs_add_cart_item' === $class ) {
$path .= '/switching'; $path .= '/switching';
} elseif ( false !== strpos( $class, 'wc_report' ) ) {
$path .= '/admin/reports/deprecated';
} elseif ( false !== strpos( $class, 'wcs_report' ) ) { } elseif ( false !== strpos( $class, 'wcs_report' ) ) {
$path .= '/admin/reports'; $path .= '/admin/reports';
} elseif ( false !== strpos( $class, 'retry' ) || false !== strpos( $class, 'retries' ) ) { } elseif ( false !== strpos( $class, 'retry' ) || false !== strpos( $class, 'retries' ) ) {
@@ -122,13 +120,10 @@ class WCS_Autoloader extends WCS_Core_Autoloader {
*/ */
protected function should_autoload( $class ) { protected function should_autoload( $class ) {
static $legacy = array( static $legacy = array(
'wc_order_item_pending_switch' => 1, 'wc_order_item_pending_switch' => 1,
'wc_report_retention_rate' => 1,
'wc_report_upcoming_recurring_revenue' => 1,
); );
return isset( $legacy[ $class ] ) ? true : parent::should_autoload( $class ); return isset( $legacy[ $class ] ) ? true : parent::should_autoload( $class );
} }
/** /**

View File

@@ -39,7 +39,7 @@ class WCS_Early_Renewal_Modal_Handler {
'text' => __( 'Pay now', 'woocommerce-subscriptions' ), 'text' => __( 'Pay now', 'woocommerce-subscriptions' ),
'attributes' => array( 'attributes' => array(
'id' => 'early_renewal_modal_submit', 'id' => 'early_renewal_modal_submit',
'class' => 'button alt ', 'class' => 'button alt',
'href' => add_query_arg( array( 'href' => add_query_arg( array(
'subscription_id' => $subscription->get_id(), 'subscription_id' => $subscription->get_id(),
'process_early_renewal' => true, 'process_early_renewal' => true,
@@ -49,6 +49,10 @@ class WCS_Early_Renewal_Modal_Handler {
), ),
); );
if ( wc_wp_theme_get_element_class_name( 'button' ) ) {
$place_order_action['attributes']['class'] .= ' ' . wc_wp_theme_get_element_class_name( 'button' );
}
$callback_args = array( $callback_args = array(
'callback' => array( __CLASS__, 'output_early_renewal_modal' ), 'callback' => array( __CLASS__, 'output_early_renewal_modal' ),
'parameters' => array( 'subscription' => $subscription ), 'parameters' => array( 'subscription' => $subscription ),

View File

@@ -1695,19 +1695,6 @@ class WC_Subscriptions_Switcher {
return $inclusions; return $inclusions;
} }
/**
* If a product is being marked as not purchasable because it is limited and the customer has a subscription,
* but the current request is to switch the subscription, then mark it as purchasable.
*
* @since 1.4.4
* @return bool
* @deprecated 2.1
*/
public static function is_purchasable( $is_purchasable, $product ) {
_deprecated_function( __METHOD__, '2.1', 'WCS_Limiter::is_purchasable_switch' );
return WCS_Limiter::is_purchasable_switch( $is_purchasable, $product );
}
/** /**
* Do not carry over switch related meta data to renewal orders. * Do not carry over switch related meta data to renewal orders.
* *
@@ -1795,26 +1782,6 @@ class WC_Subscriptions_Switcher {
} }
} }
/**
* Checks if a product can be switched based on it's type and the types which can be switched
*
* @since 1.5.21
*/
public static function is_product_of_switchable_type( $product ) {
_deprecated_function( __METHOD__, '2.0.7', 'wcs_is_product_switchable_type' );
$allow_switching = false;
$switch_setting = get_option( WC_Subscriptions_Admin::$option_prefix . '_allow_switching', 'no' );
// does the current switch setting allow switching for variable or variable_grouped
if ( 'variable_grouped' == $switch_setting || ( $product->is_type( array( 'variable-subscription', 'subscription_variation' ) ) && 'variable' == $switch_setting ) || ( 'grouped' == $switch_setting && ( $product->is_type( 'grouped' ) || wcs_get_objects_property( $product, 'parent_id' ) ) ) ) {
$allow_switching = true;
}
return $allow_switching;
}
/** /**
* Check if a given subscription item was for upgrading/downgrading an existing item. * Check if a given subscription item was for upgrading/downgrading an existing item.
* *
@@ -2436,40 +2403,6 @@ class WC_Subscriptions_Switcher {
return $orders_to_display; return $orders_to_display;
} }
/** Deprecated Methods **/
/**
* Automatically set a switch order's status to complete (even if the items require shipping because
* the order is simply a record of the switch and not indicative of an item needing to be shipped)
*
* @since 1.5
*/
public static function subscription_switch_autocomplete( $new_order_status, $order_id ) {
_deprecated_function( __METHOD__, '2.1.3', 'WC_Subscriptions_Order::maybe_autocomplete_order' );
return WC_Subscriptions_Order::maybe_autocomplete_order( $new_order_status, $order_id );
}
/**
* Once payment is processed on a switch from a $0 / period subscription to a non-zero $ / period subscription, if
* payment was completed with a payment method which supports automatic payments, update the payment on the subscription
* and the manual renewals flag so that future renewals are processed automatically.
*
* @param array $payment_processing_result
* @param int $order_id
* @since 2.0.16
* @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 )' );
$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 );
}
return $payment_processing_result;
}
/** /**
* Override the order item quantity used to reduce stock levels when the order item is to record a switch and where no * Override the order item quantity used to reduce stock levels when the order item is to record a switch and where no
* prorated amount is being charged. * prorated amount is being charged.
@@ -2651,343 +2584,6 @@ class WC_Subscriptions_Switcher {
return $add_to_cart_text; return $add_to_cart_text;
} }
/**
* Don't allow switched subscriptions to be cancelled.
*
* @param bool $subscription_can_be_changed
* @param array $subscription A subscription of the form created by @see WC_Subscriptions_Manager::get_subscription()
* @since 1.4
* @deprecated 2.0
*/
public static function can_subscription_be_cancelled( $subscription_can_be_changed, $subscription ) {
_deprecated_function( __METHOD__, '2.0' );
if ( 'switched' == $subscription['status'] ) {
$subscription_can_be_changed = false;
}
return $subscription_can_be_changed;
}
/**
* Adds a "Switch" button to the "My Subscriptions" table for those subscriptions can be upgraded/downgraded.
*
* @param array $all_actions The $subscription_key => $actions array with all actions that will be displayed for a subscription on the "My Subscriptions" table
* @param array $subscriptions All of a given users subscriptions that will be displayed on the "My Subscriptions" table
* @since 1.4
* @deprecated 2.0
*/
public static function add_switch_button( $all_actions, $subscriptions ) {
_deprecated_function( __METHOD__, '2.0', __CLASS__ . '::print_switch_button( $subscription, $item )' );
$user_id = get_current_user_id();
foreach ( $all_actions as $subscription_key => $actions ) {
if ( WC_Subscriptions_Manager::can_subscription_be_changed_to( 'new-subscription', $subscription_key, $user_id ) ) {
$all_actions[ $subscription_key ] = array(
'switch' => array(
'url' => self::get_switch_link( $subscription_key ),
'name' => get_option( WC_Subscriptions_Admin::$option_prefix . '_switch_button_text', __( 'Upgrade or Downgrade', 'woocommerce-subscriptions' ) ),
),
) + $all_actions[ $subscription_key ];
}
}
return $all_actions;
}
/**
* The link for switching a subscription - the product page for variable subscriptions, or grouped product page for grouped subscriptions.
*
* @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key()
* @since 1.4
* @deprecated 2.0
*/
public static function get_switch_link( $subscription_key ) {
_deprecated_function( __METHOD__, '2.0', __CLASS__ . '::get_switch_url( $item_id, $item, $subscription )' );
}
/**
* Add a 'new-subscription' handler to the WC_Subscriptions_Manager::can_subscription_be_changed_to() function.
*
* For the subscription to be switchable, switching must be enabled, and the subscription must:
* - be active or on-hold
* - be a variable subscription or part of a grouped product (at the time the check is made, not at the time the subscription was purchased)
* - be using manual renewals or use a payment method which supports cancellation
*
* @param bool $subscription_can_be_changed Flag of whether the subscription can be changed to
* @param string $new_status_or_meta The status or meta data you want to change the subscription to. Can be 'active', 'on-hold', 'cancelled', 'expired', 'trash', 'deleted', 'failed', 'AMQPChannel to the 'woocommerce_can_subscription_be_changed_to' filter.
* @param object $args Set of values used in @see WC_Subscriptions_Manager::can_subscription_be_changed_to() for determining if a subscription can be changed
* @since 1.4
* @deprecated 2.0
*/
public static function can_subscription_be_changed_to( $subscription_can_be_changed, $new_status_or_meta, $args ) {
_deprecated_function( __METHOD__, '2.0', __CLASS__ . '::can_item_be_switched( $item, $subscription )' );
return false;
}
/**
* Check if the cart includes a request to switch a subscription.
*
* @return bool Returns true if any item in the cart is a subscription switch request, otherwise, false.
* @since 1.4
* @deprecated 2.0
*/
public static function cart_contains_subscription_switch() {
_deprecated_function( __METHOD__, '2.0', __CLASS__ . '::cart_contains_switches()' );
$cart_contains_subscription_switch = self::cart_contains_switches();
// For backward compatiblity, only send the first switch item, not all of them
if ( false !== $cart_contains_subscription_switch ) {
$cart_contains_subscription_switch = array_pop( $cart_contains_subscription_switch );
}
return $cart_contains_subscription_switch;
}
/**
* Previously, we used a trial period to make sure totals are calculated correctly (i.e. order total does not include any recurring
* amounts) but we didn't want switched subscriptions to actually have a trial period, so reset the value on the order after checkout.
*
* This is all redundant now that trial period isn't stored on a subscription item. The first payment date will be used instead.
*
* @since 1.4
* @deprecated 2.0
*/
public static function fix_order_item_meta( $item_id, $values ) {
_deprecated_function( __METHOD__, '2.0' );
}
/**
* Add the next payment date to the end of the subscription to clarify when the new rate will be charged
*
* @since 1.4
* @deprecated 2.0
*/
public static function customise_subscription_price_string( $subscription_string ) {
_deprecated_function( __METHOD__, '2.0' );
}
/**
* Never display the trial period for a subscription switch (we're only setting it to calculate correct totals)
*
* @since 1.4
* @deprecated 2.0
*/
public static function customise_cart_subscription_string_details( $subscription_details ) {
_deprecated_function( __METHOD__, '2.0' );
return $subscription_details;
}
/**
* Make sure when calculating the first payment date for a switched subscription, the date takes into
* account the switch (i.e. prepaid days and possibly a downgrade).
*
* @since 1.4
* @deprecated 2.0
*/
public static function calculate_first_payment_date( $next_payment_date, $order, $product_id, $type ) {
_deprecated_function( __METHOD__, '2.0' );
return self::get_first_payment_date( $next_payment_date, WC_Subscriptions_Manager::get_subscription_key( wcs_get_objects_property( $order, 'id' ), $product_id ), $order->get_user_id(), $type );
}
/**
* Make sure anything requesting the first payment date for a switched subscription receives a date which
* takes into account the switch (i.e. prepaid days and possibly a downgrade).
*
* This is necessary as the self::calculate_first_payment_date() is not called when the subscription is active
* (which it isn't until the first payment is completed and the subscription is activated).
*
* @deprecated 2.0
*/
public static function get_first_payment_date( $next_payment_date, $subscription_key, $user_id, $type ) {
_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 = (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;
}
}
return $next_payment_date;
}
/**
* Add an i18n'ified string for the "switched" subscription status.
*
* @since 1.4
* @deprecated 2.0
*/
public static function add_switched_status_string( $status_string ) {
_deprecated_function( __METHOD__, '2.0' );
if ( 'switched' === strtolower( $status_string ) ) {
$status_string = _x( 'Switched', 'Subscription status', 'woocommerce-subscriptions' );
}
return $status_string;
}
/**
* Set the subscription prices to be used in calculating totals by @see WC_Subscriptions_Cart::calculate_subscription_totals()
*
* @since 1.4
* @deprecated 2.0
*/
public static function maybe_set_apporitioned_totals( $total ) {
_deprecated_function( __METHOD__, '2.0', __CLASS__ . '::calculate_prorated_totals()' );
return $total;
}
/**
* If the subscription purchased in an order has since been switched, include a link to the order placed to switch the subscription
* in the "Related Orders" meta box (displayed on the Edit Order screen).
*
* @param WC_Order $order The current order.
* @since 1.4
* @deprecated 2.0
*/
public static function switch_order_meta_box_section( $order ) {
_deprecated_function( __METHOD__, '2.0' );
}
/**
* After payment is completed on an order for switching a subscription, complete the switch.
*
* @param WC_Order|int $order A WC_Order object or ID of a WC_Order order.
* @since 1.4
* @deprecated 2.0
*/
public static function maybe_complete_switch( $order_id ) {
_deprecated_function( __METHOD__, '2.0' );
}
/**
* Check if a given order was created to switch a subscription.
*
* @param WC_Order $order An order to check.
* @return bool Returns true if the order switched a subscription, otherwise, false.
* @since 1.4
*/
public static function order_contains_subscription_switch( $order_id ) {
_deprecated_function( __METHOD__, '2.0', 'wcs_order_contains_switch( $order_id )' );
return wcs_order_contains_switch( $order_id );
}
/**
* Store the order line item id so it can be retrieved when we're processing the switch on checkout
*
* @param int $order_id
* @param array $checkout_posted_data
* @since 2.2.0
*/
public static function set_switch_order_item_id( $order_id, $posted_checkout_data ) {
_deprecated_function( __METHOD__, '2.2.1', 'WCS_Cart_Switch::set_cart_item_order_item_id()' );
$order = wc_get_order( $order_id );
foreach ( $order->get_items( 'line_item' ) as $order_item_id => $order_item ) {
$cart_item_key = $order_item->get_meta( '_switched_cart_item_key' );
if ( ! empty( $cart_item_key ) ) {
foreach ( WC()->cart->recurring_carts as $recurring_cart_key => $recurring_cart ) {
// If this cart item belongs to this recurring cart
if ( in_array( $cart_item_key, array_keys( $recurring_cart->cart_contents ) ) && isset( WC()->cart->recurring_carts[ $recurring_cart_key ]->cart_contents[ $cart_item_key ]['subscription_switch'] ) ) {
WC()->cart->recurring_carts[ $recurring_cart_key ]->cart_contents[ $cart_item_key ]['subscription_switch']['order_line_item_id'] = $order_item_id;
wc_add_order_item_meta( WC()->cart->recurring_carts[ $recurring_cart_key ]->cart_contents[ $cart_item_key ]['subscription_switch']['item_id'], '_switched_subscription_new_item_id', $order_item_id, true );
}
}
}
}
}
/**
* Filter the WC_Subscription::get_related_orders() method to include switch orders.
*
* @since 2.0
* @deprecated
*
* @param array $related_orders
* @param WC_Subscription $subscription
* @param string $return_fields
* @param string $order_type
*
* @return array
*/
public static function add_related_orders( $related_orders, $subscription, $return_fields, $order_type ) {
wcs_deprecated_function( __METHOD__, '2.3.0', 'wcs_get_switch_orders_for_subscription()' );
if ( in_array( $order_type, array( 'all', 'switch' ) ) ) {
$switch_orders = wcs_get_switch_orders_for_subscription( $subscription->get_id() );
if ( 'all' == $return_fields ) {
$related_orders += $switch_orders;
} else {
foreach ( $switch_orders as $order_id => $order ) {
$related_orders[ $order_id ] = $order_id;
}
}
// This will change the ordering to be by ID instead of the default of date
krsort( $related_orders );
}
return $related_orders;
}
/**
* If the subscription purchased in an order has since been switched, include a link to the order placed to switch the subscription
* in the "Related Orders" meta box (displayed on the Edit Order screen).
*
* @param WC_Order $order The current order.
* @since 1.4
* @deprecated 3.1.0
*/
public static function switch_order_meta_box_rows( $post ) {
wcs_deprecated_function( __METHOD__, '3.1.0' );
$subscriptions = array();
$switched_subscriptions = array();
$orders = array();
// On the subscription page, just show related orders
if ( wcs_is_subscription( $post->ID ) ) {
// Select the orders which switched item/s from this subscription
$orders = wcs_get_switch_orders_for_subscription( $post->ID );
foreach ( $orders as $order_id => $order ) {
wcs_set_objects_property( $order, 'relationship', __( 'Switch Order', 'woocommerce-subscriptions' ), 'set_prop_only' );
}
// Select the subscriptions which had item/s switched to this subscription by its parent order
if ( ! empty( $post->post_parent ) ) {
$switched_subscriptions = wcs_get_subscriptions_for_switch_order( $post->post_parent );
}
// On the Edit Order screen, show any subscriptions with items switched by this order
} else {
$switched_subscriptions = wcs_get_subscriptions_for_switch_order( $post->ID );
}
if ( is_array( $switched_subscriptions ) ) {
foreach ( $switched_subscriptions as $subscription_id => $subscription ) {
wcs_set_objects_property( $subscription, 'relationship', __( 'Switched Subscription', 'woocommerce-subscriptions' ), 'set_prop_only' );
$orders[ $subscription_id ] = $subscription;
}
}
foreach ( $orders as $order ) {
include( WC_Subscriptions_Core_Plugin::instance()->get_subscriptions_core_directory( 'includes/admin/meta-boxes/views/html-related-orders-row.php' ) );
}
}
/** /**
* Removes subscription items from recurring carts which have been handled. * Removes subscription items from recurring carts which have been handled.
* *

View File

@@ -2,14 +2,14 @@
# This file is distributed under the same license as the WooCommerce Subscriptions plugin. # This file is distributed under the same license as the WooCommerce Subscriptions plugin.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WooCommerce Subscriptions 6.9.1\n" "Project-Id-Version: WooCommerce Subscriptions 7.0.0\n"
"Report-Msgid-Bugs-To: https://woocommerce.com/contact-us\n" "Report-Msgid-Bugs-To: https://woocommerce.com/contact-us\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-11-27T02:14:55+00:00\n" "POT-Creation-Date: 2024-12-16T23:30:24+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.11.0\n" "X-Generator: WP-CLI 2.11.0\n"
"X-Domain: woocommerce-subscriptions\n" "X-Domain: woocommerce-subscriptions\n"
@@ -905,7 +905,6 @@ msgstr ""
#. translators: placeholder is an error message. #. translators: placeholder is an error message.
#: includes/api/legacy/class-wc-rest-subscriptions-controller.php:287 #: includes/api/legacy/class-wc-rest-subscriptions-controller.php:287
#: includes/api/v1/class-wc-rest-subscriptions-v1-controller.php:475 #: includes/api/v1/class-wc-rest-subscriptions-v1-controller.php:475
#: includes/api/v1/class-wc-rest-subscriptions-v1-controller.php:781
msgid "Updating subscription dates errored with message: %s" msgid "Updating subscription dates errored with message: %s"
msgstr "" msgstr ""
@@ -1111,8 +1110,8 @@ msgstr ""
#: includes/class-wcs-call-to-action-button-text-manager.php:55 #: includes/class-wcs-call-to-action-button-text-manager.php:55
#: includes/class-wcs-call-to-action-button-text-manager.php:58 #: includes/class-wcs-call-to-action-button-text-manager.php:58
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-checkout.php:657 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-checkout.php:657
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:1199 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:1202
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:1231 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:1234
msgid "Sign up now" msgid "Sign up now"
msgstr "" msgstr ""
@@ -1338,7 +1337,7 @@ msgstr ""
#: includes/early-renewal/wcs-early-renewal-functions.php:136 #: includes/early-renewal/wcs-early-renewal-functions.php:136
#: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-row.php:18 #: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-related-orders-row.php:18
#: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-unknown-related-orders-row.php:18 #: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-unknown-related-orders-row.php:18
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php:171 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php:172
#: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:36 #: vendor/woocommerce/subscriptions-core/templates/myaccount/my-subscriptions.php:36
#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:45 #: vendor/woocommerce/subscriptions-core/templates/myaccount/related-orders.php:45
#: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:34 #: vendor/woocommerce/subscriptions-core/templates/myaccount/related-subscriptions.php:34
@@ -1386,37 +1385,37 @@ msgstr ""
msgid "Pay now" msgid "Pay now"
msgstr "" msgstr ""
#: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:57 #: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:61
msgid "Renew early" msgid "Renew early"
msgstr "" msgstr ""
#: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:73 #: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:77
#: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-subscription-schedule.php:24 #: vendor/woocommerce/subscriptions-core/includes/admin/meta-boxes/views/html-subscription-schedule.php:24
msgid "Payment:" msgid "Payment:"
msgstr "" msgstr ""
#: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:107 #: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:111
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:226 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-change-payment-gateway.php:226
msgid "There was an error with your request. Please try again." msgid "There was an error with your request. Please try again."
msgstr "" msgstr ""
#: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:114 #: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:118
msgid "We were unable to locate that subscription, please try again." msgid "We were unable to locate that subscription, please try again."
msgstr "" msgstr ""
#: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:119 #: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:123
msgid "You can't renew the subscription at this time. Please try again." msgid "You can't renew the subscription at this time. Please try again."
msgstr "" msgstr ""
#: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:129 #: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:133
msgid "We couldn't create a renewal order for your subscription, please try again." msgid "We couldn't create a renewal order for your subscription, please try again."
msgstr "" msgstr ""
#: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:146 #: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:150
msgid "Payment for the renewal order was unsuccessful with your payment method on file, please try again." msgid "Payment for the renewal order was unsuccessful with your payment method on file, please try again."
msgstr "" msgstr ""
#: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:158 #: includes/early-renewal/class-wcs-early-renewal-modal-handler.php:162
msgid "Your early renewal order was successful." msgid "Your early renewal order was successful."
msgstr "" msgstr ""
@@ -1804,7 +1803,6 @@ msgstr ""
#: includes/switching/class-wc-subscriptions-switcher.php:450 #: includes/switching/class-wc-subscriptions-switcher.php:450
#: includes/switching/class-wc-subscriptions-switcher.php:552 #: includes/switching/class-wc-subscriptions-switcher.php:552
#: includes/switching/class-wc-subscriptions-switcher.php:2691
msgid "Upgrade or Downgrade" msgid "Upgrade or Downgrade"
msgstr "" msgstr ""
@@ -1847,68 +1845,60 @@ msgstr ""
msgid "There was an error locating the switch details." msgid "There was an error locating the switch details."
msgstr "" msgstr ""
#: includes/switching/class-wc-subscriptions-switcher.php:1879 #: includes/switching/class-wc-subscriptions-switcher.php:1846
msgctxt "a switch type" msgctxt "a switch type"
msgid "Downgrade" msgid "Downgrade"
msgstr "" msgstr ""
#: includes/switching/class-wc-subscriptions-switcher.php:1882 #: includes/switching/class-wc-subscriptions-switcher.php:1849
msgctxt "a switch type" msgctxt "a switch type"
msgid "Upgrade" msgid "Upgrade"
msgstr "" msgstr ""
#: includes/switching/class-wc-subscriptions-switcher.php:1885 #: includes/switching/class-wc-subscriptions-switcher.php:1852
msgctxt "a switch type" msgctxt "a switch type"
msgid "Crossgrade" msgid "Crossgrade"
msgstr "" msgstr ""
#. translators: %1: product subtotal, %2: HTML span tag, %3: direction (upgrade, downgrade, crossgrade), %4: closing HTML span tag #. translators: %1: product subtotal, %2: HTML span tag, %3: direction (upgrade, downgrade, crossgrade), %4: closing HTML span tag
#: includes/switching/class-wc-subscriptions-switcher.php:1890 #: includes/switching/class-wc-subscriptions-switcher.php:1857
msgctxt "product subtotal string" msgctxt "product subtotal string"
msgid "%1$s %2$s(%3$s)%4$s" msgid "%1$s %2$s(%3$s)%4$s"
msgstr "" msgstr ""
#: includes/switching/class-wc-subscriptions-switcher.php:2006 #: includes/switching/class-wc-subscriptions-switcher.php:1973
msgid "The original subscription item being switched cannot be found." msgid "The original subscription item being switched cannot be found."
msgstr "" msgstr ""
#: includes/switching/class-wc-subscriptions-switcher.php:2008 #: includes/switching/class-wc-subscriptions-switcher.php:1975
msgid "The item on the switch order cannot be found." msgid "The item on the switch order cannot be found."
msgstr "" msgstr ""
#. translators: 1$: old item, 2$: new item when switching #. translators: 1$: old item, 2$: new item when switching
#: includes/switching/class-wc-subscriptions-switcher.php:2019 #: includes/switching/class-wc-subscriptions-switcher.php:1986
msgctxt "used in order notes" msgctxt "used in order notes"
msgid "Customer switched from: %1$s to %2$s." msgid "Customer switched from: %1$s to %2$s."
msgstr "" msgstr ""
#. translators: %s: new item name. #. translators: %s: new item name.
#: includes/switching/class-wc-subscriptions-switcher.php:2022 #: includes/switching/class-wc-subscriptions-switcher.php:1989
msgctxt "used in order notes" msgctxt "used in order notes"
msgid "Customer added %s." msgid "Customer added %s."
msgstr "" msgstr ""
#: includes/switching/class-wc-subscriptions-switcher.php:2417 #: includes/switching/class-wc-subscriptions-switcher.php:2384
#: includes/switching/class-wc-subscriptions-switcher.php:2965
msgid "Switch Order" msgid "Switch Order"
msgstr "" msgstr ""
#: includes/switching/class-wc-subscriptions-switcher.php:2432 #: includes/switching/class-wc-subscriptions-switcher.php:2399
#: includes/switching/class-wc-subscriptions-switcher.php:2980
msgid "Switched Subscription" msgid "Switched Subscription"
msgstr "" msgstr ""
#: includes/switching/class-wc-subscriptions-switcher.php:2648 #: includes/switching/class-wc-subscriptions-switcher.php:2581
msgctxt "add to cart button text while switching a subscription" msgctxt "add to cart button text while switching a subscription"
msgid "Switch subscription" msgid "Switch subscription"
msgstr "" msgstr ""
#: includes/switching/class-wc-subscriptions-switcher.php:2829
#: vendor/woocommerce/subscriptions-core/wcs-functions.php:223
msgctxt "Subscription status"
msgid "Switched"
msgstr ""
#: includes/switching/class-wcs-cart-switch.php:180 #: includes/switching/class-wcs-cart-switch.php:180
msgctxt "The place order button text while switching a subscription" msgctxt "The place order button text while switching a subscription"
msgid "Switch subscription" msgid "Switch subscription"
@@ -2678,12 +2668,12 @@ msgid "Delete Permanently"
msgstr "" msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-post-types.php:1406 #: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-post-types.php:1406
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:762 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:765
msgid "Restore this item from the Trash" msgid "Restore this item from the Trash"
msgstr "" msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-post-types.php:1408 #: vendor/woocommerce/subscriptions-core/includes/admin/class-wcs-admin-post-types.php:1408
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:763 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:766
msgid "Restore" msgid "Restore"
msgstr "" msgstr ""
@@ -4094,14 +4084,14 @@ msgid "Parent Order"
msgstr "" msgstr ""
#. translators: %1$s refers to the price. This string is meant to prefix another string below, e.g. "$5 now, and $5 on March 15th each year" #. translators: %1$s refers to the price. This string is meant to prefix another string below, e.g. "$5 now, and $5 on March 15th each year"
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:287 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:290
msgid "%1$s now, and " msgid "%1$s now, and "
msgstr "" msgstr ""
#. translators: 1$: recurring amount string, 2$: day of the week (e.g. "$10 every Wednesday"). #. translators: 1$: recurring amount string, 2$: day of the week (e.g. "$10 every Wednesday").
#. translators: 1$: recurring amount string, 2$: day of the week (e.g. "$10 every Wednesday") #. translators: 1$: recurring amount string, 2$: day of the week (e.g. "$10 every Wednesday")
#. translators: %1$: recurring amount (e.g. "$15"), %2$: subscription period (e.g. "month") (e.g. "$15 every 2nd month") #. translators: %1$: recurring amount (e.g. "$15"), %2$: subscription period (e.g. "month") (e.g. "$15 every 2nd month")
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:296 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:299
#: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:116 #: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:116
#: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:201 #: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:201
msgid "%1$s every %2$s" msgid "%1$s every %2$s"
@@ -4109,56 +4099,56 @@ msgstr ""
#. translators: 1$: recurring amount string, 2$: period, 3$: day of the week (e.g. "$10 every 2nd week on Wednesday"). #. translators: 1$: recurring amount string, 2$: period, 3$: day of the week (e.g. "$10 every 2nd week on Wednesday").
#. translators: 1$: recurring amount string, 2$: period, 3$: day of the week (e.g. "$10 every 2nd week on Wednesday") #. translators: 1$: recurring amount string, 2$: period, 3$: day of the week (e.g. "$10 every 2nd week on Wednesday")
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:300 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:303
#: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:125 #: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:125
msgid "%1$s every %2$s on %3$s" msgid "%1$s every %2$s on %3$s"
msgstr "" msgstr ""
#. translators: placeholder is recurring amount. #. translators: placeholder is recurring amount.
#. translators: placeholder is recurring amount #. translators: placeholder is recurring amount
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:311 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:314
#: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:143 #: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:143
msgid "%s on the last day of each month" msgid "%s on the last day of each month"
msgstr "" msgstr ""
#. translators: 1$: recurring amount, 2$: day of the month (e.g. "23rd") (e.g. "$5 every 23rd of each month"). #. translators: 1$: recurring amount, 2$: day of the month (e.g. "23rd") (e.g. "$5 every 23rd of each month").
#. translators: 1$: recurring amount, 2$: day of the month (e.g. "23rd") (e.g. "$5 every 23rd of each month") #. translators: 1$: recurring amount, 2$: day of the month (e.g. "23rd") (e.g. "$5 every 23rd of each month")
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:315 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:318
#: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:146 #: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:146
msgid "%1$s on the %2$s of each month" msgid "%1$s on the %2$s of each month"
msgstr "" msgstr ""
#. translators: 1$: recurring amount, 2$: interval (e.g. "3rd") (e.g. "$10 on the last day of every 3rd month"). #. translators: 1$: recurring amount, 2$: interval (e.g. "3rd") (e.g. "$10 on the last day of every 3rd month").
#. translators: 1$: recurring amount, 2$: interval (e.g. "3rd") (e.g. "$10 on the last day of every 3rd month") #. translators: 1$: recurring amount, 2$: interval (e.g. "3rd") (e.g. "$10 on the last day of every 3rd month")
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:324 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:327
#: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:162 #: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:162
msgid "%1$s on the last day of every %2$s month" msgid "%1$s on the last day of every %2$s month"
msgstr "" msgstr ""
#. translators: 1$: <price> on the, 2$: <date> day of every, 3$: <interval> month (e.g. "$10 on the 23rd day of every 2nd month"). #. translators: 1$: <price> on the, 2$: <date> day of every, 3$: <interval> month (e.g. "$10 on the 23rd day of every 2nd month").
#. translators: 1$: recurring amount, 2$: day of the month (e.g. "23rd") (e.g. "$5 every 23rd of each month") #. translators: 1$: recurring amount, 2$: day of the month (e.g. "23rd") (e.g. "$5 every 23rd of each month")
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:331 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:334
#: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:165 #: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:165
msgid "%1$s on the %2$s day of every %3$s month" msgid "%1$s on the %2$s day of every %3$s month"
msgstr "" msgstr ""
#. translators: 1$: <price> on, 2$: <date>, 3$: <month> each year (e.g. "$15 on March 15th each year"). #. translators: 1$: <price> on, 2$: <date>, 3$: <month> each year (e.g. "$15 on March 15th each year").
#. translators: 1$: recurring amount, 2$: month (e.g. "March"), 3$: day of the month (e.g. "23rd") (e.g. "$15 on March 15th every 3rd year") #. translators: 1$: recurring amount, 2$: month (e.g. "March"), 3$: day of the month (e.g. "23rd") (e.g. "$15 on March 15th every 3rd year")
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:343 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:346
#: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:178 #: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:178
msgid "%1$s on %2$s %3$s each year" msgid "%1$s on %2$s %3$s each year"
msgstr "" msgstr ""
#. translators: 1$: recurring amount, 2$: month (e.g. "March"), 3$: day of the month (e.g. "23rd"). #. translators: 1$: recurring amount, 2$: month (e.g. "March"), 3$: day of the month (e.g. "23rd").
#. translators: 1$: recurring amount, 2$: month (e.g. "March"), 3$: day of the month (e.g. "23rd") (e.g. "$15 on March 15th every 3rd year") #. translators: 1$: recurring amount, 2$: month (e.g. "March"), 3$: day of the month (e.g. "23rd") (e.g. "$15 on March 15th every 3rd year")
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:351 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:354
#: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:187 #: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:187
msgid "%1$s on %2$s %3$s every %4$s year" msgid "%1$s on %2$s %3$s every %4$s year"
msgstr "" msgstr ""
#. translators: 1$: recurring amount, 2$: subscription period (e.g. "month" or "3 months") (e.g. "$15 / month" or "$15 every 2nd month"). #. translators: 1$: recurring amount, 2$: subscription period (e.g. "month" or "3 months") (e.g. "$15 / month" or "$15 every 2nd month").
#. translators: 1$: recurring amount, 2$: subscription period (e.g. "month" or "3 months") (e.g. "$15 / month" or "$15 every 2nd month") #. translators: 1$: recurring amount, 2$: subscription period (e.g. "month" or "3 months") (e.g. "$15 / month" or "$15 every 2nd month")
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:363 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:366
#: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:198 #: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:198
msgid "%1$s / %2$s" msgid "%1$s / %2$s"
msgid_plural "%1$s every %2$s" msgid_plural "%1$s every %2$s"
@@ -4166,37 +4156,37 @@ msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#. translators: billing period (e.g. "every week"). #. translators: billing period (e.g. "every week").
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:373 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:376
msgid "every %s" msgid "every %s"
msgstr "" msgstr ""
#. translators: 1$: subscription string (e.g. "$10 up front then $5 on March 23rd every 3rd year"), 2$: length (e.g. "4 years"). #. translators: 1$: subscription string (e.g. "$10 up front then $5 on March 23rd every 3rd year"), 2$: length (e.g. "4 years").
#. translators: 1$: subscription string (e.g. "$10 up front then $5 on March 23rd every 3rd year"), 2$: length (e.g. "4 years") #. translators: 1$: subscription string (e.g. "$10 up front then $5 on March 23rd every 3rd year"), 2$: length (e.g. "4 years")
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:383 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:386
#: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:209 #: vendor/woocommerce/subscriptions-core/includes/wcs-formatting-functions.php:209
msgid "%1$s for %2$s" msgid "%1$s for %2$s"
msgstr "" msgstr ""
#. translators: 1$: subscription string (e.g. "$15 on March 15th every 3 years for 6 years"), 2$: trial length (e.g.: "with 4 months free trial"). #. translators: 1$: subscription string (e.g. "$15 on March 15th every 3 years for 6 years"), 2$: trial length (e.g.: "with 4 months free trial").
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:389 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:392
msgid "%1$s with %2$s free trial" msgid "%1$s with %2$s free trial"
msgstr "" msgstr ""
#. translators: 1$: subscription string (e.g. "$15 on March 15th every 3 years for 6 years with 2 months free trial"), 2$: signup fee price (e.g. "and a $30 sign-up fee"). #. translators: 1$: subscription string (e.g. "$15 on March 15th every 3 years for 6 years with 2 months free trial"), 2$: signup fee price (e.g. "and a $30 sign-up fee").
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:394 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:397
msgid "%1$s and a %2$s sign-up fee" msgid "%1$s and a %2$s sign-up fee"
msgstr "" msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:972 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-product.php:975
msgid "This variation can not be removed because it is associated with existing subscriptions. To remove this variation, please permanently delete any related subscriptions." msgid "This variation can not be removed because it is associated with existing subscriptions. To remove this variation, please permanently delete any related subscriptions."
msgstr "" msgstr ""
#. translators: placeholder is order ID #. translators: placeholder is order ID
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php:174 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php:175
msgid "Order %s created to record renewal." msgid "Order %s created to record renewal."
msgstr "" msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php:194 #: vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-renewal-order.php:195
msgid "Subscription renewal orders cannot be cancelled." msgid "Subscription renewal orders cannot be cancelled."
msgstr "" msgstr ""
@@ -4558,20 +4548,20 @@ msgstr ""
msgid "You have successfully removed \"%1$s\" from your subscription. %2$sUndo?%3$s" msgid "You have successfully removed \"%1$s\" from your subscription. %2$sUndo?%3$s"
msgstr "" msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wcs-remove-item.php:176 #: vendor/woocommerce/subscriptions-core/includes/class-wcs-remove-item.php:180
#: vendor/woocommerce/subscriptions-core/includes/class-wcs-user-change-status-handler.php:107 #: vendor/woocommerce/subscriptions-core/includes/class-wcs-user-change-status-handler.php:107
msgid "Security error. Please contact us if you need assistance." msgid "Security error. Please contact us if you need assistance."
msgstr "" msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wcs-remove-item.php:180 #: vendor/woocommerce/subscriptions-core/includes/class-wcs-remove-item.php:184
msgid "You cannot modify a subscription that does not belong to you." msgid "You cannot modify a subscription that does not belong to you."
msgstr "" msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wcs-remove-item.php:184 #: vendor/woocommerce/subscriptions-core/includes/class-wcs-remove-item.php:188
msgid "You cannot remove an item that does not exist. " msgid "You cannot remove an item that does not exist. "
msgstr "" msgstr ""
#: vendor/woocommerce/subscriptions-core/includes/class-wcs-remove-item.php:188 #: vendor/woocommerce/subscriptions-core/includes/class-wcs-remove-item.php:192
msgid "The item was not removed because this Subscription's payment method does not support removing an item." msgid "The item was not removed because this Subscription's payment method does not support removing an item."
msgstr "" msgstr ""
@@ -7288,11 +7278,11 @@ msgstr ""
msgid "Actions" msgid "Actions"
msgstr "" msgstr ""
#: vendor/woocommerce/subscriptions-core/templates/myaccount/subscription-details.php:101 #: vendor/woocommerce/subscriptions-core/templates/myaccount/subscription-details.php:107
msgid "Subscription updates" msgid "Subscription updates"
msgstr "" msgstr ""
#: vendor/woocommerce/subscriptions-core/templates/myaccount/subscription-details.php:107 #: vendor/woocommerce/subscriptions-core/templates/myaccount/subscription-details.php:113
msgctxt "date on subscription updates list. Will be localized" msgctxt "date on subscription updates list. Will be localized"
msgid "l jS \\o\\f F Y, h:ia" msgid "l jS \\o\\f F Y, h:ia"
msgstr "" msgstr ""
@@ -7347,6 +7337,11 @@ msgctxt "Subscription status"
msgid "On hold" msgid "On hold"
msgstr "" msgstr ""
#: vendor/woocommerce/subscriptions-core/wcs-functions.php:223
msgctxt "Subscription status"
msgid "Switched"
msgstr ""
#: vendor/woocommerce/subscriptions-core/wcs-functions.php:225 #: vendor/woocommerce/subscriptions-core/wcs-functions.php:225
msgctxt "Subscription status" msgctxt "Subscription status"
msgid "Pending Cancellation" msgid "Pending Cancellation"

2
vendor/autoload.php vendored
View File

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

View File

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

View File

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

View File

@@ -156,21 +156,21 @@
}, },
{ {
"name": "woocommerce/subscriptions-core", "name": "woocommerce/subscriptions-core",
"version": "7.7.2", "version": "7.8.0",
"version_normalized": "7.7.2.0", "version_normalized": "7.8.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Automattic/woocommerce-subscriptions-core.git", "url": "https://github.com/Automattic/woocommerce-subscriptions-core.git",
"reference": "f4bce1c1368e0e547922df7580ad578b0c9beea2" "reference": "14e7b3d5df82a0f4d4942b8119e85087e4863a65"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/f4bce1c1368e0e547922df7580ad578b0c9beea2", "url": "https://api.github.com/repos/Automattic/woocommerce-subscriptions-core/zipball/14e7b3d5df82a0f4d4942b8119e85087e4863a65",
"reference": "f4bce1c1368e0e547922df7580ad578b0c9beea2", "reference": "14e7b3d5df82a0f4d4942b8119e85087e4863a65",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"composer/installers": "~1.2", "composer/installers": "^1.2 || ^2.2",
"php": "^7.1" "php": "^7.1"
}, },
"require-dev": { "require-dev": {
@@ -179,7 +179,7 @@
"woocommerce/woocommerce-sniffs": "0.1.0", "woocommerce/woocommerce-sniffs": "0.1.0",
"yoast/phpunit-polyfills": "1.1.0" "yoast/phpunit-polyfills": "1.1.0"
}, },
"time": "2024-11-27T00:02:10+00:00", "time": "2024-12-16T23:11:09+00:00",
"type": "wordpress-plugin", "type": "wordpress-plugin",
"extra": { "extra": {
"phpcodesniffer-search-depth": 2 "phpcodesniffer-search-depth": 2
@@ -209,7 +209,7 @@
"description": "Sell products and services with recurring payments in your WooCommerce Store.", "description": "Sell products and services with recurring payments in your WooCommerce Store.",
"homepage": "https://github.com/Automattic/woocommerce-subscriptions-core", "homepage": "https://github.com/Automattic/woocommerce-subscriptions-core",
"support": { "support": {
"source": "https://github.com/Automattic/woocommerce-subscriptions-core/tree/7.7.2", "source": "https://github.com/Automattic/woocommerce-subscriptions-core/tree/7.8.0",
"issues": "https://github.com/Automattic/woocommerce-subscriptions-core/issues" "issues": "https://github.com/Automattic/woocommerce-subscriptions-core/issues"
}, },
"install-path": "../woocommerce/subscriptions-core" "install-path": "../woocommerce/subscriptions-core"

View File

@@ -1,9 +1,9 @@
<?php return array( <?php return array(
'root' => array( 'root' => array(
'name' => 'woocommerce/woocommerce-subscriptions', 'name' => 'woocommerce/woocommerce-subscriptions',
'pretty_version' => 'dev-release/6.9.1', 'pretty_version' => 'dev-release/7.0.0',
'version' => 'dev-release/6.9.1', 'version' => 'dev-release/7.0.0',
'reference' => 'c2bc23e1cc88e5c38bc2cc63365cca6a2a7dd741', 'reference' => '71fd6cf0194bb9921cb70197177e77436a8fe3d8',
'type' => 'wordpress-plugin', 'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@@ -32,18 +32,18 @@
), ),
), ),
'woocommerce/subscriptions-core' => array( 'woocommerce/subscriptions-core' => array(
'pretty_version' => '7.7.2', 'pretty_version' => '7.8.0',
'version' => '7.7.2.0', 'version' => '7.8.0.0',
'reference' => 'f4bce1c1368e0e547922df7580ad578b0c9beea2', 'reference' => '14e7b3d5df82a0f4d4942b8119e85087e4863a65',
'type' => 'wordpress-plugin', 'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../woocommerce/subscriptions-core', 'install_path' => __DIR__ . '/../woocommerce/subscriptions-core',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'woocommerce/woocommerce-subscriptions' => array( 'woocommerce/woocommerce-subscriptions' => array(
'pretty_version' => 'dev-release/6.9.1', 'pretty_version' => 'dev-release/7.0.0',
'version' => 'dev-release/6.9.1', 'version' => 'dev-release/7.0.0',
'reference' => 'c2bc23e1cc88e5c38bc2cc63365cca6a2a7dd741', 'reference' => '71fd6cf0194bb9921cb70197177e77436a8fe3d8',
'type' => 'wordpress-plugin', 'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),

View File

@@ -7,6 +7,11 @@
} }
} }
.subscription_details .button {
display: inline-block;
margin-bottom: 0.5em;
}
.subscription-auto-renew-toggle { .subscription-auto-renew-toggle {
margin-left: 5px; margin-left: 5px;
margin-bottom: 2px; margin-bottom: 2px;

View File

@@ -1,5 +1,12 @@
*** WooCommerce Subscriptions Core Changelog *** *** WooCommerce Subscriptions Core Changelog ***
= 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.
* Fix - Subscription totals not properly updating when customers remove items via the My Account > View Subscription page on some stores with caching enabled.
* Fix - Resolved unexpected errors during the renewal process when a subscription contains metadata with key "id".
* Update - Changed the link on the order thank-you page to take customers directly to their "My Account > Subscriptions" page.
= 7.7.2 - 2024-11-26 = = 7.7.2 - 2024-11-26 =
* Fix - Prevents notices being displayed on WordPress 6.7 due to loading translations too early. * Fix - Prevents notices being displayed on WordPress 6.7 due to loading translations too early.

View File

@@ -110,7 +110,7 @@ class WC_Product_Subscription_Variation extends WC_Product_Variation {
* @return string * @return string
*/ */
public function single_add_to_cart_text() { public function single_add_to_cart_text() {
return apply_filters( 'woocommerce_product_single_add_to_cart_text', self::add_to_cart_text(), $this ); return apply_filters( 'woocommerce_product_single_add_to_cart_text', WC_Subscriptions_Product::get_add_to_cart_text(), $this );
} }
/** /**

View File

@@ -16,7 +16,7 @@ class WC_Subscriptions_Core_Plugin {
* The version of subscriptions-core library. * The version of subscriptions-core library.
* @var string * @var string
*/ */
protected $library_version = '7.7.2'; // WRCS: DEFINED_VERSION. protected $library_version = '7.8.0'; // WRCS: DEFINED_VERSION.
/** /**
* The subscription scheduler instance. * The subscription scheduler instance.

View File

@@ -41,6 +41,7 @@ class WC_Subscriptions_Data_Copier {
'_trial_period', '_trial_period',
'_created_via', '_created_via',
'_order_stock_reduced', '_order_stock_reduced',
'id',
]; ];
/** /**

View File

@@ -339,7 +339,7 @@ class WC_Subscriptions_Order {
$subscriptions = wcs_get_subscriptions_for_order( $order_id, array( 'order_type' => 'any' ) ); $subscriptions = wcs_get_subscriptions_for_order( $order_id, array( 'order_type' => 'any' ) );
$subscription_count = count( $subscriptions ); $subscription_count = count( $subscriptions );
$thank_you_message = ''; $thank_you_message = '';
$my_account_subscriptions_url = get_permalink( wc_get_page_id( 'myaccount' ) ); $my_account_subscriptions_url = wc_get_endpoint_url( 'subscriptions', '', wc_get_page_permalink( 'myaccount' ) );
if ( $subscription_count ) { if ( $subscription_count ) {
foreach ( $subscriptions as $subscription ) { foreach ( $subscriptions as $subscription ) {

View File

@@ -127,6 +127,9 @@ class WC_Subscriptions_Product {
foreach ( $grouped_product->get_children() as $child_product_id ) { foreach ( $grouped_product->get_children() as $child_product_id ) {
$child_product = wc_get_product( $child_product_id ); $child_product = wc_get_product( $child_product_id );
if ( ! $child_product instanceof WC_Product ) {
continue;
}
if ( self::is_subscription( $child_product_id ) ) { if ( self::is_subscription( $child_product_id ) ) {
$contains_subscription = true; $contains_subscription = true;

View File

@@ -139,7 +139,8 @@ class WC_Subscriptions_Renewal_Order {
if ( $is_failed_renewal_order ) { if ( $is_failed_renewal_order ) {
do_action( 'woocommerce_subscriptions_paid_for_failed_renewal_order', wc_get_order( $order_id ), $subscription ); do_action( 'woocommerce_subscriptions_paid_for_failed_renewal_order', wc_get_order( $order_id ), $subscription );
} }
} elseif ( 'failed' == $orders_new_status ) { } elseif ( 'failed' === $orders_new_status && wcs_is_order_last_renewal_of_subscription( $order, $subscription ) ) {
// We will suspend the subscription if the latest renewal order fails.
$subscription->payment_failed(); $subscription->payment_failed();
} }
} }

View File

@@ -152,7 +152,7 @@ class WCS_Query extends WC_Query {
* @return string * @return string
*/ */
public function maybe_redirect_to_only_subscription( $url, $endpoint ) { public function maybe_redirect_to_only_subscription( $url, $endpoint ) {
if ( $this->query_vars['subscriptions'] === $endpoint && is_account_page() ) { if ( $this->query_vars['subscriptions'] === $endpoint && ( is_account_page() || is_order_received_page() ) ) {
$subscriptions = wcs_get_users_subscriptions(); $subscriptions = wcs_get_users_subscriptions();
if ( is_array( $subscriptions ) && 1 === count( $subscriptions ) && apply_filters( 'wcs_my_account_redirect_to_single_subscription', true ) ) { if ( is_array( $subscriptions ) && 1 === count( $subscriptions ) && apply_filters( 'wcs_my_account_redirect_to_single_subscription', true ) ) {

View File

@@ -143,6 +143,10 @@ class WCS_Remove_Item {
} }
} }
// Clear cache after updating subscription items.
clean_post_cache( $subscription->get_id() );
wc_delete_shop_order_transients( $subscription );
/** /**
* In WooCommerce 3.0 the subscription object and its items override the database with their current content, * In WooCommerce 3.0 the subscription object and its items override the database with their current content,
* so we lost the changes we just did with `wc_update_order_item`. Re-reading the object fixes this problem. * so we lost the changes we just did with `wc_update_order_item`. Re-reading the object fixes this problem.

View File

@@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
* 'product_id' The post ID of a WC_Product_Subscription, WC_Product_Variable_Subscription or WC_Product_Subscription_Variation object * 'product_id' The post ID of a WC_Product_Subscription, WC_Product_Variable_Subscription or WC_Product_Subscription_Variation object
* 'order_id' The post ID of a shop_order post/WC_Order object which was used to create the subscription * 'order_id' The post ID of a shop_order post/WC_Order object which was used to create the subscription
* 'subscription_status' Any valid subscription status. Can be 'any', 'active', 'cancelled', 'on-hold', 'expired', 'pending' or 'trash'. Defaults to 'any'. * 'subscription_status' Any valid subscription status. Can be 'any', 'active', 'cancelled', 'on-hold', 'expired', 'pending' or 'trash'. Defaults to 'any'.
* 'order_type' Get subscriptions for the any order type in this array. Can include 'any', 'parent', 'renewal' or 'switch', defaults to parent. * 'order_type' Get subscriptions for the any order type in this array. Can include 'any', 'parent', 'renewal', 'resubscribe' or 'switch', defaults to 'parent'.
* @return WC_Subscription[] Subscription details in post_id => WC_Subscription form. * @return WC_Subscription[] Subscription details in post_id => WC_Subscription form.
* @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0 * @since 1.0.0 - Migrated from WooCommerce Subscriptions v2.0
*/ */

View File

@@ -111,7 +111,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php <?php
echo wp_kses( echo wp_kses(
apply_filters( 'woocommerce_change_payment_button_html', '<input type="submit" class="button alt" id="place_order" value="' . esc_attr( $pay_order_button_text ) . '" data-value="' . esc_attr( $pay_order_button_text ) . '" />' ), apply_filters( 'woocommerce_change_payment_button_html', '<input type="submit" class="button alt' . esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ) . '" id="place_order" value="' . esc_attr( $pay_order_button_text ) . '" data-value="' . esc_attr( $pay_order_button_text ) . '" />' ),
array( array(
'input' => array( 'input' => array(
'type' => array(), 'type' => array(),

View File

@@ -50,7 +50,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php echo wp_kses_post( $subscription->get_formatted_order_total() ); ?> <?php echo wp_kses_post( $subscription->get_formatted_order_total() ); ?>
</td> </td>
<td class="subscription-actions order-actions woocommerce-orders-table__cell woocommerce-orders-table__cell-subscription-actions woocommerce-orders-table__cell-order-actions"> <td class="subscription-actions order-actions woocommerce-orders-table__cell woocommerce-orders-table__cell-subscription-actions woocommerce-orders-table__cell-order-actions">
<a href="<?php echo esc_url( $subscription->get_view_order_url() ) ?>" class="woocommerce-button button view"><?php echo esc_html_x( 'View', 'view a subscription', 'woocommerce-subscriptions' ); ?></a> <a href="<?php echo esc_url( $subscription->get_view_order_url() ) ?>" class="woocommerce-button button view<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>"><?php echo esc_html_x( 'View', 'view a subscription', 'woocommerce-subscriptions' ); ?></a>
<?php do_action( 'woocommerce_my_subscriptions_actions', $subscription ); ?> <?php do_action( 'woocommerce_my_subscriptions_actions', $subscription ); ?>
</td> </td>
</tr> </tr>

View File

@@ -89,7 +89,7 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( $actions ) { if ( $actions ) {
foreach ( $actions as $key => $action ) { foreach ( $actions as $key => $action ) {
echo wp_kses_post( '<a href="' . esc_url( $action['url'] ) . '" class="woocommerce-button button ' . sanitize_html_class( $key ) . '">' . esc_html( $action['name'] ) . '</a>' ); echo wp_kses_post( '<a href="' . esc_url( $action['url'] ) . '" class="woocommerce-button button ' . sanitize_html_class( $key ) . esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ) . '">' . esc_html( $action['name'] ) . '</a>' );
} }
} }
?> ?>

View File

@@ -44,7 +44,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php echo wp_kses_post( $subscription->get_formatted_order_total() ); ?> <?php echo wp_kses_post( $subscription->get_formatted_order_total() ); ?>
</td> </td>
<td class="subscription-actions order-actions woocommerce-orders-table__cell woocommerce-orders-table__cell-subscription-actions woocommerce-orders-table__cell-order-actions"> <td class="subscription-actions order-actions woocommerce-orders-table__cell woocommerce-orders-table__cell-subscription-actions woocommerce-orders-table__cell-order-actions">
<a href="<?php echo esc_url( $subscription->get_view_order_url() ) ?>" class="woocommerce-button button view"><?php echo esc_html_x( 'View', 'view a subscription', 'woocommerce-subscriptions' ); ?></a> <a href="<?php echo esc_url( $subscription->get_view_order_url() ); ?>" class="woocommerce-button button view<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>"><?php echo esc_html_x( 'View', 'view a subscription', 'woocommerce-subscriptions' ); ?></a>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>

View File

@@ -81,11 +81,17 @@ if ( ! defined( 'ABSPATH' ) ) {
<td><?php esc_html_e( 'Actions', 'woocommerce-subscriptions' ); ?></td> <td><?php esc_html_e( 'Actions', 'woocommerce-subscriptions' ); ?></td>
<td> <td>
<?php foreach ( $actions as $key => $action ) : ?> <?php foreach ( $actions as $key => $action ) : ?>
<?php $classes = [ 'button', sanitize_html_class( $key ) ]; ?> <?php
<?php $classes[] = isset( $action['block_ui'] ) && $action['block_ui'] ? 'wcs_block_ui_on_click' : '' ?> $classes = [ 'woocommerce-button', 'button', sanitize_html_class( $key ) ];
$classes[] = isset( $action['block_ui'] ) && $action['block_ui'] ? 'wcs_block_ui_on_click' : '';
if ( wc_wp_theme_get_element_class_name( 'button' ) ) {
$classes[] = wc_wp_theme_get_element_class_name( 'button' );
}
?>
<a <a
href="<?php echo esc_url( $action['url'] ); ?>" href="<?php echo esc_url( $action['url'] ); ?>"
class="<?php echo trim( implode( ' ', $classes ) ); ?>" class="<?php echo esc_attr( trim( implode( ' ', $classes ) ) ); ?>"
> >
<?php echo esc_html( $action['name'] ); ?> <?php echo esc_html( $action['name'] ); ?>
</a> </a>

View File

@@ -26,7 +26,7 @@ if ( $product->is_in_stock() ) : ?>
<?php if ( ! $product->is_purchasable() && 0 !== $user_id && 'no' !== wcs_get_product_limitation( $product ) && wcs_is_product_limited_for_user( $product, $user_id ) ) : ?> <?php if ( ! $product->is_purchasable() && 0 !== $user_id && 'no' !== wcs_get_product_limitation( $product ) && wcs_is_product_limited_for_user( $product, $user_id ) ) : ?>
<?php $resubscribe_link = wcs_get_users_resubscribe_link_for_product( $product->get_id() ); ?> <?php $resubscribe_link = wcs_get_users_resubscribe_link_for_product( $product->get_id() ); ?>
<?php if ( ! empty( $resubscribe_link ) && 'any' === wcs_get_product_limitation( $product ) && wcs_user_has_subscription( $user_id, $product->get_id(), wcs_get_product_limitation( $product ) ) && ! wcs_user_has_subscription( $user_id, $product->get_id(), 'active' ) && ! wcs_user_has_subscription( $user_id, $product->get_id(), 'on-hold' ) ) : // customer has an inactive subscription, maybe offer the renewal button. ?> <?php if ( ! empty( $resubscribe_link ) && 'any' === wcs_get_product_limitation( $product ) && wcs_user_has_subscription( $user_id, $product->get_id(), wcs_get_product_limitation( $product ) ) && ! wcs_user_has_subscription( $user_id, $product->get_id(), 'active' ) && ! wcs_user_has_subscription( $user_id, $product->get_id(), 'on-hold' ) ) : // customer has an inactive subscription, maybe offer the renewal button. ?>
<a href="<?php echo esc_url( $resubscribe_link ); ?>" class="button product-resubscribe-link"><?php esc_html_e( 'Resubscribe', 'woocommerce-subscriptions' ); ?></a> <a href="<?php echo esc_url( $resubscribe_link ); ?>" class="button product-resubscribe-link<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>"><?php esc_html_e( 'Resubscribe', 'woocommerce-subscriptions' ); ?></a>
<?php else : ?> <?php else : ?>
<p class="limited-subscription-notice notice"><?php esc_html_e( 'You have an active subscription to this product already.', 'woocommerce-subscriptions' ); ?></p> <p class="limited-subscription-notice notice"><?php esc_html_e( 'You have an active subscription to this product already.', 'woocommerce-subscriptions' ); ?></p>
<?php endif; ?> <?php endif; ?>

View File

@@ -25,7 +25,7 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?>
<?php if ( ! $product->is_purchasable() && 0 !== $user_id && 'no' !== wcs_get_product_limitation( $product ) && wcs_is_product_limited_for_user( $product, $user_id ) ) : ?> <?php if ( ! $product->is_purchasable() && 0 !== $user_id && 'no' !== wcs_get_product_limitation( $product ) && wcs_is_product_limited_for_user( $product, $user_id ) ) : ?>
<?php $resubscribe_link = wcs_get_users_resubscribe_link_for_product( $product->get_id() ); ?> <?php $resubscribe_link = wcs_get_users_resubscribe_link_for_product( $product->get_id() ); ?>
<?php if ( ! empty( $resubscribe_link ) && 'any' === wcs_get_product_limitation( $product ) && wcs_user_has_subscription( $user_id, $product->get_id(), wcs_get_product_limitation( $product ) ) && ! wcs_user_has_subscription( $user_id, $product->get_id(), 'active' ) && ! wcs_user_has_subscription( $user_id, $product->get_id(), 'on-hold' ) ) : // customer has an inactive subscription, maybe offer the renewal button. ?> <?php if ( ! empty( $resubscribe_link ) && 'any' === wcs_get_product_limitation( $product ) && wcs_user_has_subscription( $user_id, $product->get_id(), wcs_get_product_limitation( $product ) ) && ! wcs_user_has_subscription( $user_id, $product->get_id(), 'active' ) && ! wcs_user_has_subscription( $user_id, $product->get_id(), 'on-hold' ) ) : // customer has an inactive subscription, maybe offer the renewal button. ?>
<a href="<?php echo esc_url( $resubscribe_link ); ?>" class="woocommerce-button button product-resubscribe-link"><?php esc_html_e( 'Resubscribe', 'woocommerce-subscriptions' ); ?></a> <a href="<?php echo esc_url( $resubscribe_link ); ?>" class="woocommerce-button button product-resubscribe-link<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>"><?php esc_html_e( 'Resubscribe', 'woocommerce-subscriptions' ); ?></a>
<?php else : ?> <?php else : ?>
<p class="limited-subscription-notice notice"><?php esc_html_e( 'You have an active subscription to this product already.', 'woocommerce-subscriptions' ); ?></p> <p class="limited-subscription-notice notice"><?php esc_html_e( 'You have an active subscription to this product already.', 'woocommerce-subscriptions' ); ?></p>
<?php endif; ?> <?php endif; ?>

View File

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

View File

@@ -5,7 +5,7 @@
* Description: Sell products and services with recurring payments in your WooCommerce Store. * Description: Sell products and services with recurring payments in your WooCommerce Store.
* Author: WooCommerce * Author: WooCommerce
* Author URI: https://woocommerce.com/ * Author URI: https://woocommerce.com/
* Version: 6.9.1 * Version: 7.0.0
* Requires Plugins: woocommerce * Requires Plugins: woocommerce
* *
* WC requires at least: 8.7.1 * WC requires at least: 8.7.1
@@ -78,7 +78,7 @@ class WC_Subscriptions {
public static $plugin_file = __FILE__; public static $plugin_file = __FILE__;
/** @var string */ /** @var string */
public static $version = '6.9.1'; // WRCS: DEFINED_VERSION. public static $version = '7.0.0'; // WRCS: DEFINED_VERSION.
/** @var string */ /** @var string */
public static $wc_minimum_supported_version = '7.7'; public static $wc_minimum_supported_version = '7.7';