add_action( 'woocommerce_before_calculate_totals', 'remove_discount_using_dynamic_instance', 20 ); function remove_discount_using_dynamic_instance() { global $wp_filter; if ( isset( $wp_filter['woocommerce_cart_calculate_fees'] ) ) { foreach ( $wp_filter['woocommerce_cart_calculate_fees']->callbacks as $priority => $callbacks ) { foreach ( $callbacks as $callback_key => $callback ) { if ( is_array( $callback['function'] ) && $callback['function'][1] === 'FUNCTION_NAME_TO_REMOVE' && is_checkout() ) { remove_action( 'woocommerce_cart_calculate_fees', $callback['function'], $priority ); } } } } }
Jagdish Sarma Asked question December 10, 2024