Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit 632d99b

Browse files
wjrosajames-allan
andauthored
Removing the unused method maybe_remove_formatted_order_total_filter due deprecation (#668)
* Fix non-editable subscriptions text * Keeping it compatible with past version * Adding support for subscriptions tooltip when HPOS is enabled * Fix additional method checking current page with HPOS enabled * Turning method private * Refactoring the new methods to use shared code * Adding changelog entry * New HPOS compatibility function * Usage of the new HPOS compatibility function * Git ignore * Adding specific unit test * PHP unit tests shortcut * Adding specific unit tests for the new helper function * Expand new unit test to cover maybe_unattach_gettext_callback * Expand new unit test to cover maybe_unattach_gettext_callback * Unit test for change_order_item_editable_text * Fix tests * Reverting unnecessary changes * Adding changelog entry * Fix tests * Update includes/admin/class-wc-subscriptions-admin.php Co-authored-by: James Allan <[email protected]> * Removing deprecated helper function * Reverting unnecessary changes * Updating changelog entry * Deprecating method instead of removing it --------- Co-authored-by: James Allan <[email protected]>
1 parent d191d74 commit 632d99b

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*** WooCommerce Subscriptions Core Changelog ***
22

33
= 7.5.0 - 2024-xx-xx =
4+
* Dev - Removing the unused method `maybe_remove_formatted_order_total_filter` hooked to `woocommerce_get_formatted_order_total` which was deprecated.
45
* Fix - Resolved two issues preventing the correct display of the "Subscription items can no longer be edited." message on the Edit Subscription page.
56
* Fix - Checks for the existence of `wc_get_page_screen_id` before calling it on `wcs_get_page_screen_id`, and for the admin context before calling `list_table_primary_column` to prevent fatal errors.
67
* Fix - Blocks the reactivation of a subscription when the end date is in the past.

includes/admin/class-wc-subscriptions-admin.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ public static function init() {
132132

133133
add_action( 'woocommerce_payment_gateways_setting_column_renewals', array( __CLASS__, 'payment_gateways_renewal_support' ) );
134134

135-
// Do not display formatted order total on the Edit Order administration screen
136-
add_filter( 'woocommerce_get_formatted_order_total', __CLASS__ . '::maybe_remove_formatted_order_total_filter', 0, 2 );
137-
138135
add_action( 'woocommerce_payment_gateways_settings', __CLASS__ . '::add_recurring_payment_gateway_information', 10, 1 );
139136

140137
// Change text for when order items cannot be edited
@@ -1829,18 +1826,10 @@ public static function payment_gateways_rewewal_support( $gateway ) {
18291826
* Do not display formatted order total on the Edit Order administration screen
18301827
*
18311828
* @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.17
1829+
* @deprecated 7.5.0
18321830
*/
18331831
public static function maybe_remove_formatted_order_total_filter( $formatted_total, $order ) {
1834-
1835-
// Check if we're on the Edit Order screen - get_current_screen() only exists on admin pages so order of operations matters here
1836-
if ( is_admin() && function_exists( 'get_current_screen' ) ) {
1837-
1838-
$screen = get_current_screen();
1839-
1840-
if ( is_object( $screen ) && 'shop_order' == $screen->id ) {
1841-
remove_filter( 'woocommerce_get_formatted_order_total', 'WC_Subscriptions_Order::get_formatted_order_total', 10 );
1842-
}
1843-
}
1832+
wcs_deprecated_function( __METHOD__, '7.5.0' );
18441833

18451834
return $formatted_total;
18461835
}

0 commit comments

Comments
 (0)