[Support request] Display ADD TO CART button on specific page only

Home Forums Support [Support request] Display ADD TO CART button on specific page only

Home Forums Support Display ADD TO CART button on specific page only

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2193094
    johnaps

    Hello!

    I tried searching for this but didnt find anything relative…

    I have Display add to cart button disabled in the customizer, but i want the button to exist in cart page…
    Can you tell me what function to use to enable it there?

    Thank you in advance!

    #2193109
    David
    Staff
    Customer Support

    Hi there,

    not sure but you could try using woocommerce_is_purchasable filter to disable add to cart on all pages apart from the cart page:

    add_filter('woocommerce_is_purchasable', function( $is_purchasable ) {
        if ( !is_cart() ) {
            $is_purchasable = false;
        }
        return $is_purchasable;
    } );
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.