Archived topic
Display ADD TO CART button on specific page only
1 reply · Started by johnaps on April 19, 2022
Viewing posts 1–2 of 2
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!
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;
} );
This archived topic is closed to new replies.