Remove add to cart button and keep variations
-
I’m trying to remove the add to cart button and the price from WooCommerce. Using the solutions I’ve found so far, the add to cart button and price are removed, but the product variations are also removed.
I would like customers to see the product variations dropdown, but not be able to add it to the cart or see any prices.
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); return '<a href="' . get_permalink(woocommerce_get_page_id('myaccount')) . '">Login to See Prices</a>';
The above code removes the price, add to cart and variations.
add_filter( 'woocommerce_is_purchasable', false );
This disables the add to cart, but doesn’t remove it. I would ideally not like to resort to hiding these via CSS.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Remove add to cart button and keep variations’ is closed to new replies.