When you apply a coupon code programmatically, or when you really need it anyway, you may want to hide the coupon code on the cart page.

This is simply because you want to avoid that certain customers will know the coupon code and try to give it to someone else.

woocommerce-hide-coupon-code-cart-page
woocommerce-hide-coupon-code-cart-page
WooCommerce: hide coupon codes on the cart page

Snippet (PHP): Remove / Rename Coupon Code from Cart Totals – WooCommerce


/**
 * @snippet       Hide WooCommerce Coupon Code - WooCommerce Cart & Checkout
 * @how-to        Get CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=536
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.5.3
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_filter( 'woocommerce_cart_totals_coupon_label', 'bbloomer_hide_coupon_code', 99, 2 );

function bbloomer_hide_coupon_code( $label, $coupon ) {
    return 'Coupon Applied!'; 
}

Share:

Leave a Reply