Create Custom Menu in WordPress Dashboard
Complete tutorial on create custom menu in wordpress dashboard. Discover practical examples, implementation tips, and expert advice for WordPress and WooCo
Read More →
You can enhance your WooCommerce store by showing users the total discount they've received on both the cart and checkout pages. Use the following approach: Step 1: Open your theme's functions.php file or your custom plugin file. Step 2: Add this snippet:
// Show total discount in WooCommerce cart and checkout
function display_total_discount() {
$total_discount = WC()->cart->get_cart_discount_total();
if ($total_discount > 0) {
$formatted_discount = wc_price($total_discount);
echo '<tr class="total-discount"><th>' . __('Total Discount', 'your-text-domain') . '</th><td data-title="' . __('Total Discount', 'your-text-domain') . '">' . $formatted_discount . '</td></tr>';
}
}
add_action('woocommerce_cart_totals_before_order_total', 'display_total_discount');
add_action('woocommerce_review_order_before_order_total', 'display_total_discount');
This function fetches the total discount using get_cart_discount_total() and displays it as a table row before the final order total. Make sure to use your actual text domain and tweak the styles if necessary to match your store’s look. 
Search our archives or reach out to our team for solutions and expert advice.