Skip to content

Commit

Permalink
Updates to 7.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WooCommerce committed Dec 18, 2024
1 parent 8c0d9ae commit 60a125d
Show file tree
Hide file tree
Showing 38 changed files with 139 additions and 731 deletions.
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
*** 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
* Fix: Resolved compatibility issues with WordPress 6.7 caused by translating strings too early.
* Dev: Update subscriptions-core to 7.7.2
Expand Down
28 changes: 0 additions & 28 deletions includes/admin/class-wcs-admin-reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,32 +223,4 @@ public static function get_report( $name ) {
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;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

74 changes: 0 additions & 74 deletions includes/api/v1/class-wc-rest-subscriptions-v1-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -707,78 +707,4 @@ public function get_item_schema() {
$schema['properties'] += $subscriptions_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 );
}
}
}
7 changes: 1 addition & 6 deletions includes/class-wcs-autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ protected function get_relative_class_path( $class ) {

if ( stripos( $class, 'switch' ) !== false || 'wcs_add_cart_item' === $class ) {
$path .= '/switching';
} elseif ( false !== strpos( $class, 'wc_report' ) ) {
$path .= '/admin/reports/deprecated';
} elseif ( false !== strpos( $class, 'wcs_report' ) ) {
$path .= '/admin/reports';
} elseif ( false !== strpos( $class, 'retry' ) || false !== strpos( $class, 'retries' ) ) {
Expand Down Expand Up @@ -122,13 +120,10 @@ protected function get_relative_class_path( $class ) {
*/
protected function should_autoload( $class ) {
static $legacy = array(
'wc_order_item_pending_switch' => 1,
'wc_report_retention_rate' => 1,
'wc_report_upcoming_recurring_revenue' => 1,
'wc_order_item_pending_switch' => 1,
);

return isset( $legacy[ $class ] ) ? true : parent::should_autoload( $class );

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static function maybe_print_early_renewal_modal( $subscription ) {
'text' => __( 'Pay now', 'woocommerce-subscriptions' ),
'attributes' => array(
'id' => 'early_renewal_modal_submit',
'class' => 'button alt ',
'class' => 'button alt',
'href' => add_query_arg( array(
'subscription_id' => $subscription->get_id(),
'process_early_renewal' => true,
Expand All @@ -49,6 +49,10 @@ public static function maybe_print_early_renewal_modal( $subscription ) {
),
);

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' => array( __CLASS__, 'output_early_renewal_modal' ),
'parameters' => array( 'subscription' => $subscription ),
Expand Down
Loading

0 comments on commit 60a125d

Please sign in to comment.