• 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)
  • Mina

    (@purpleberryservices)

    If you really want to remove it altogether, remove the code of displaying “Add to Cart” button from following template files.
    1. woocommerce/templates/loop/add-to-cart.php
    2. And from all the files there in woocommerce/templates/single-product/add-to-cart folders.

    Thread Starter originalmmd

    (@originalmmd)

    I’m only removing it for non logged in users and the default user group. There will be an additional user group that will have access to the shopping cart features.

    Mina

    (@purpleberryservices)

    That needs a bit complex solution and can not be covered here.

    • This reply was modified 8 years, 1 month ago by Mina.

    Did you ever find a work around this? Still can not find anything on the internet on how to do this.

    and with this i mean : “Remove add to cart button and keep variations”

    • This reply was modified 7 years, 4 months ago by sjoerd89.
    Thread Starter originalmmd

    (@originalmmd)

    @sjoerd89 I eventually used Javascript to remove the button element from the page on load and when the variation is selected.

    • This reply was modified 7 years, 4 months ago by originalmmd.

    Any documentation about how you managed to do this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove add to cart button and keep variations’ is closed to new replies.