Change the word “Coupon” to “Discount” text in the cart
The Advanced Dynamic Pricing for WooCommerce plugin applies discounts automatically based on your pricing rules. In the cart and checkout pages, WooCommerce labels these discounted amounts as “Coupon:” followed by the discount code. However, since the discounts generated by the plugin are not customer‑entered coupon codes, the word “Coupon” can be confusing or technically inaccurate. Many store owners prefer to rename this label to “Discount” or any other custom text that better reflects the nature of the price reduction.
This guide provides a simple PHP code snippet that changes the word “Coupon” to “Discount” everywhere it appears in the cart and checkout. The code is safe, easy to implement, and fully customisable.
Note: This code works with the Advanced Dynamic Pricing for WooCommerce plugin, but it is a general WooCommerce filter that replaces any occurrence of “Coupon” in the cart totals. It will affect any discount line item generated by WooCommerce, including those from coupon codes.
The Complete Code Snippet
123 add_filter( 'woocommerce_cart_totals_coupon_label', function ( $label, $coupon ) {return sprintf( esc_html__( 'Discount: %s', 'woocommerce' ), $coupon->get_code() );}, 10, 2 );Note: This code affects all discount line items in the cart, not only those generated by the Advanced Dynamic Pricing plugin. If you also use regular coupon codes, they will also be displayed as “Discount”. That is usually acceptable because the customer still sees the correct amount, but be aware of this behaviour.
What Problem Does This Code Solve?
When the Advanced Dynamic Pricing plugin applies a discount to the cart (e.g., 10% off for a specific user role), WooCommerce displays the discount in the cart totals section as:
text
Coupon: [discount-name] -$10.00The word “Coupon” is misleading because the customer did not enter any coupon code. The discount was applied automatically based on a pricing rule. This can confuse customers who might think they need to enter a code to receive the discount, or who wonder where the “coupon” came from.
The code snippet replaces the word “Coupon” with “Discount” (or any other term you prefer), making the cart display clearer and more accurate.
Before:
- Coupon: Bulk discount -$15.00
After:
- Discount: Bulk discount -$15.00
Step‑by‑Step Implementation
Follow these steps to add the custom code to your WordPress site.
Step 1: Choose where to add the code
You have two safe options for adding custom PHP code:
- Option A (Recommended): Use the free Code Snippets plugin. This is the safest method. It allows you to add, activate, and deactivate code snippets without ever editing your theme files. Install it from Plugins → Add New by searching for “Code Snippets”.
- Option B: Add to your child theme’s
functions.phpfile. If you are comfortable editing theme files, add the code to your active child theme’sfunctions.phpfile. Never add custom code directly to a parent theme, because it will be lost when the theme is updated.Step 2: Insert the snippet
- If using Code Snippets:
- If editing
functions.php:Step 3: Test the functionality
- Add a product to your cart that triggers a discount from the Advanced Dynamic Pricing plugin.
- Go to the cart page (or checkout page).
- In the cart totals section, locate the discount line. The label should now read “Discount: [discount name]” instead of “Coupon: [discount name]”.
- If you have a regular coupon code, apply it and verify that it also appears as “Discount”.
If the label has changed, the implementation is successful.