Home Forums Themes Support Claue Recommendations and New Ideas

Topic Resolution: Not a Question

This topic contains 30 replies, has 4 voices, and was last updated by  Rahim 1 week ago.

Viewing 31 post (of 31 total)
  • Author
    Posts
  • #25565

    Hello guys,

    Hope all of you are fine.

    For those who want to hide the coupon code section on the cart page or checkout page this is a usable function to add to your functions.php of your active theme.

    Some of you may like to force the customer to apply the coupon just on the cart page, or some others of you like me would like to have only one section for the coupon code at the end on the checkout page.

    So for any need just add these to your functions.php.

    Hiding coupon code on the cart page:

    // hide coupon field on cart page
    
    function hide_coupon_field_on_cart( $enabled ) {
    
    if ( is_cart() ) {
    
    $enabled = false;
    
    }
    
    return $enabled;
    
    }
    
    add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_cart' );

    And Hiding the coupon code on the checkout page (Not Recommended):

    // hide coupon field on checkout page
    
    function hide_coupon_field_on_checkout( $enabled ) {
    
    if ( is_checkout() ) {
    
    $enabled = false;
    
    }
    
    return $enabled;
    
    }
    
    add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_checkout' );

    Regards.

    Rahim

    Rahim Vaziri
    CEO & Founder at Look.ir

Viewing 31 post (of 31 total)

You must be logged in to reply to this topic.