Tagged: woocommerce
-
AuthorPosts
-
March 10, 2016 at 1:05 pm #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
March 10, 2016 at 7:34 pm #596528Hey 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,
JordanMarch 11, 2016 at 12:05 am #596618Hi Jordan,
Just updated the php worked great thank you for the quick response.
Alex
March 11, 2016 at 12:13 am #596625Hey!
Glad to hear that it worked!
Best regards,
JordanMarch 11, 2016 at 5:49 pm #596962Hi 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
March 11, 2016 at 9:03 pm #597042Hi 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,
JordanMarch 12, 2016 at 2:23 pm #597208Sorry i couldn’t get back to you sooner my details are below
Thanks for your help on this
Alex
March 17, 2016 at 7:40 am #599476Hi!
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.
-
AuthorPosts
- You must be logged in to reply to this topic.