Last active
November 22, 2022 10:43
-
-
Save AnanthFlycart/4d283a18b474c5fb3191c8198b27351f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To override Cart Page Overrides (increase priority to higher) | |
add_action('wp_loaded', function() { | |
if(class_exists('\Wdr\App\Router')){ | |
remove_action('woocommerce_before_calculate_totals', array(\Wdr\App\Router::$manage_discount, 'applyCartProductDiscount'), 1000); | |
add_action('woocommerce_before_calculate_totals', array(\Wdr\App\Router::$manage_discount, 'applyCartProductDiscount'), PHP_INT_MAX); | |
remove_all_filters('woocommerce_cart_item_price'); | |
add_filter('woocommerce_cart_item_price', array(\Wdr\App\Router::$manage_discount, 'getCartPriceHtml'), 1000, 3); | |
if (has_filter('woocommerce_cart_item_subtotal', array(\Wdr\App\Router::$manage_discount, 'getCartProductSubtotalPriceHtml'))) { | |
remove_all_filters('woocommerce_cart_item_subtotal'); | |
add_filter('woocommerce_cart_item_subtotal', array(\Wdr\App\Router::$manage_discount, 'getCartProductSubtotalPriceHtml'), 10, 3); | |
} else { | |
remove_all_filters('woocommerce_cart_item_subtotal'); | |
} | |
} | |
}, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment