Code snippet - Swap discount with VAT in cart
By default, WooCommerce Discount Manager adds a 'Discount' row to the cart page which displays the amount saved. This appears below the tax amount, and above the total price.
The following code snippet will allow you to swap the positions of the discount amount and tax. It is aimed at developers and if you don't know how to use it, then please see our article on using code snippets or get a quote from our customization service.
add_action( 'init', function() { $cart = \Barn2\Plugin\Discount_Manager\wdm()->get_service( 'cart' ); remove_action( 'woocommerce_cart_totals_before_order_total', [ $cart, 'show_total_discount_cart_checkout' ], 9999 ); remove_action( 'woocommerce_review_order_before_order_total', [ $cart, 'show_total_discount_cart_checkout' ], 9999 ); add_action( 'woocommerce_cart_totals_after_shipping', [ $cart, 'show_total_discount_cart_checkout' ], 1 ); add_action( 'woocommerce_cart_totals_after_shipping', [ $cart, 'show_total_discount_cart_checkout' ], 1 ); });
If searching the knowledge base hasn't answered your question, please contact support.