Skip to content

Commit

Permalink
Removing the unused method maybe_remove_formatted_order_total_filter …
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
wjrosa and james-allan authored Sep 12, 2024
1 parent d191d74 commit 632d99b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*** WooCommerce Subscriptions Core Changelog ***

= 7.5.0 - 2024-xx-xx =
* Dev - Removing the unused method `maybe_remove_formatted_order_total_filter` hooked to `woocommerce_get_formatted_order_total` which was deprecated.
* Fix - Resolved two issues preventing the correct display of the "Subscription items can no longer be edited." message on the Edit Subscription page.
* 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.
* Fix - Blocks the reactivation of a subscription when the end date is in the past.
Expand Down
15 changes: 2 additions & 13 deletions includes/admin/class-wc-subscriptions-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@ public static function init() {

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

// Do not display formatted order total on the Edit Order administration screen
add_filter( 'woocommerce_get_formatted_order_total', __CLASS__ . '::maybe_remove_formatted_order_total_filter', 0, 2 );

add_action( 'woocommerce_payment_gateways_settings', __CLASS__ . '::add_recurring_payment_gateway_information', 10, 1 );

// Change text for when order items cannot be edited
Expand Down Expand Up @@ -1829,18 +1826,10 @@ public static function payment_gateways_rewewal_support( $gateway ) {
* Do not display formatted order total on the Edit Order administration screen
*
* @since 1.0.0 - Migrated from WooCommerce Subscriptions v1.5.17
* @deprecated 7.5.0
*/
public static function maybe_remove_formatted_order_total_filter( $formatted_total, $order ) {

// Check if we're on the Edit Order screen - get_current_screen() only exists on admin pages so order of operations matters here
if ( is_admin() && function_exists( 'get_current_screen' ) ) {

$screen = get_current_screen();

if ( is_object( $screen ) && 'shop_order' == $screen->id ) {
remove_filter( 'woocommerce_get_formatted_order_total', 'WC_Subscriptions_Order::get_formatted_order_total', 10 );
}
}
wcs_deprecated_function( __METHOD__, '7.5.0' );

return $formatted_total;
}
Expand Down

0 comments on commit 632d99b

Please sign in to comment.