Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #596266

    Sorry if this has already been answered, I have been building a site for the my furniture business. Some of the products which i sell need the be sold through a request a quote plug in like YITH request a quote, due to the way they need to be priced. However this not the case for all the products.

    There is a button to deactivate the cart on all my pages through woo commerce but only need to do it to a few specific categories.

    I have the enfold child theme installed if that makes any difference

    Any help would be appreciated

    Thanks

    Alex

    #596528

    Hey alexrobson!

    Thanks for reaching out to us with that question.

    You will need to add the following code in your functions.php file:

    add_action( 'woocommerce_after_shop_loop_item', 'remove_add_to_cart_buttons', 1 );
    
        function remove_add_to_cart_buttons() {
          if( is_product_category( array( 'shirts', 'pants'))) { 
            remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
          }
        }

    In the above example it will remove the add to cart button from product categories shirts and pants. You need to change and add the categories you want the add to cart button to be removed from.

    Best regards,
    Jordan

    #596618

    Hi Jordan,

    Just updated the php worked great thank you for the quick response.

    Alex

    #596625

    Hey!

    Glad to hear that it worked!

    Best regards,
    Jordan

    #596962

    Hi Jordan,

    This was successful last night but i have gone back to start adding in some test product this morning and both the add to quote and add to basket are now there Below is the code i adapted to suit my categories from your initial template do you have any other suggestions?

    add_action( ‘woocommerce_after_shop_loop_item’, ‘remove_add_to_cart_buttons’, 1 );

    function remove_add_to_cart_buttons() {
    if( is_product_category( array( ‘bespoke-range’, ‘bespoke-italian-chairs’, ‘made-to-order-tables’, ‘made-to-order-bases’, ‘made-to-order-fitted-seating’))) {
    remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’ );
    }
    }

    The other issue is that i get this every time i add a product since making the changes to the .php

    your help would be greatly appreciated

    Alex

    • This reply was modified 8 years, 8 months ago by alexrobson. Reason: more detail on issue added
    #597042

    Hi Alex!

    Thanks for getting back to me.

    Could you please also send a link to your site along with login credentials. You can send the login details in the Private Content of your reply, so that I can have a closer look at these issues.

    Best regards,
    Jordan

    #597208

    Sorry i couldn’t get back to you sooner my details are below

    Thanks for your help on this

    Alex

    #599476

    Hi!

    Sorry for the delay.
    We are working on your ticket please wait while we update the results here soon.

    As per your request we have hidden the “Add to basket” button on all products except for the “bespoke range” category.

    We have added the following CSS in Quick CSS under Enfold > General Styling

    
    /* hide Add to cart except for bespoke range category */
    .product_cat-bespoke-range .single_add_to_cart_button {
      display: block !important;
    }
    
    .single_add_to_cart_button {
      display: none!important;
    }

    Regards,
    Vinay Kashyap

    • This reply was modified 8 years, 8 months ago by Vinay.
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.