Home » WooCommerce: Hide Coupon Code @ Cart & Checkout Page

WooCommerce: Hide Coupon Code @ Cart & Checkout Page

by adminkys

When you apply a coupon code programmatically, for example, you may want to hide the coupon code on the cart and checkout page so that the code stays private and cannot be shared with others.

This solution will basically remove the coupon code (e.g. “VWXYZ”) from the “Coupon: VWXYZ” string that appears in the Cart and Checkout totals. Enjoy!

WooCommerce: hide coupon codes on the cart page

PHP Snippet: Hide Coupon Code from WooCommerce Cart and Checkout Totals

* @snippet       Hide Coupon Code - WooCommerce Cart & Checkout
* @how-to        Get tutoraspire.com FREE
* @author        Tutor Aspire
* @compatible    WooCommerce 6
* @donate $9     https://www.tutoraspire.com

add_filter( 'woocommerce_cart_totals_coupon_label', 'tutoraspire_hide_coupon_code', 9999, 2 );

function tutoraspire_hide_coupon_code( $label, $coupon ) {
   return 'Coupon'; // Basically "Coupon: VWXYZ" becomes "Coupon"

You may also like