Home Forums WoodMart support forum remove_action add to cart button

remove_action add to cart button

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

    Chris
    Participant

    Hello
    I tried to add the following functions in functions.php file but it doesn’t work to remove the add to cart button and buy now button.
    Can you tell me the ‘hook’ to use with your theme?
    Thank you so much

    add_action( 'woocommerce_after_shop_loop_item', 'remove_add_to_cart_for_armchairs_category', 1 );
    function remove_add_to_cart_for_armchairs_category() {
        global $product;
        if ( has_term( 'armchairs', 'product_cat', $product->get_id() ) ) {
    		remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
    		remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart');
        }
    }
    
    Attachments:
    You must be logged in to view attached files.
    #547572

    Hung Pham
    Keymaster

    Hi poubelle.chris,

    Thanks for reaching to us and take our apologies for the long delay in answering.

    According to the screenshot, it seems you are using Custom WooCommerce layout, so please edit it via Elementor and remove Product add to cart widget https://prnt.sc/U2BCKsbMsuEX

    You can read more about the Layout Builder here:
    https://xtemos.com/docs-topic/woodmart-woocommerce-layout-builder/

    Regards,

Viewing 2 posts - 1 through 2 (of 2 total)