Add extra class in Woocommerce-info so I can hide Coupon section

Hi,

I have this website where I am using woocommerce. https://fridaymascara.com/kopen/extreme-volume-mascara/

We are also selling Giftcard where it doesn’t make sense to show coupon section.

Usually i can easily hide them using CSS with display:none and PHP if products are giftcard hide woocommerce-info.

The problem is both “returning client login” and “Coupon” section are under the same class “woocommerce-info” div.

how can I add extra class in the coupon section so i can individually target them in css?

Or perhaps there is another solution.

  • Alex Stine
    • System Administrator

    Hello,

    Hope you are well today.

    Could you please add this code to your themes functions.php file? This should remove the coupon box from the checkout page and the cart.

    /*Hide coupon field*/
    function hide_coupon_field_on_cart( $enabled ) {

    if ( is_cart() ) {
    $enabled = false;
    }

    return $enabled;
    }
    add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_cart' );

    function hide_coupon_field_on_checkout( $enabled ) {

    if ( is_checkout() ) {
    $enabled = false;
    }

    return $enabled;
    }
    add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_checkout' );

    Remember to take a backup first, this plugin can help with that.

    https://premium.wpmudev.org/project/snapshot/

    Please let us know if this works for you.

    Have a great day/night!

    Cheers,

    Alex :smiley:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.