Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Feature Request › Removing "Add to Cart" from Category Page
- This topic has 19 replies, 2 voices, and was last updated 5 years, 2 months ago by WCFM Forum.
- AuthorPosts
- July 24, 2019 at 5:41 pm #73758puppycirclesParticipant
Is there a way to remove the “add to cart” button from a category page? I have used the catalog mode for the individual product but the “add to cart” button still appears when you hover over the thumbnail on the category page (see attachment). I would like the rule to apply to all products in a particular category.
Thanks
Attachments:
You must be logged in to view attached files. - July 24, 2019 at 10:31 pm #73789puppycirclesParticipant
Follow-up question:
My site operates as a catalog of available “products”. Is there a way to make all vendors operate in catalog mode by default?Thanks again
- July 25, 2019 at 1:44 pm #73889WCFM ForumMember
Hi,
Please add this line to your site –
add_filter( 'woocommerce_is_purchasable', '__return_false' );
Thank You
- July 25, 2019 at 3:14 pm #73922puppycirclesParticipant
Thank You! The only issue with the filter that you provided is it is shuts down all woocommerce purchases. Generally this is fine for all vendors however I charge a reoccurring annual membership fee, so I need the filter to allow a category of products (Vendor Memberships) to be sold. The there an easy way to make some product categories purchasable and other not? Does the “Ultimate” or any of the other addons have this function?
Thanks!
- July 26, 2019 at 1:03 pm #73996WCFM ForumMember
Hi,
This is off course possible. Please know me that category ID. I will change code accordingly.
Thank You
- July 26, 2019 at 4:49 pm #74058puppycirclesParticipant
Thank you! The only category I want to be purchasable is “Vendor Memberships”
- July 29, 2019 at 12:57 pm #74373WCFM ForumMember
Understand. Create such a category and know me it’s ID.
- July 29, 2019 at 2:31 pm #74392puppycirclesParticipant
Hi There! Just wanted to make sure you received my previous reply. You had provided me with the code:
add_filter( ‘woocommerce_is_purchasable’, ‘__return_false’ );
I requested for a way to make some product categories purchasable and others not. The category I want to be made purchasable is “Vendor Memberships”
Thanks so much for your help!
- July 29, 2019 at 9:26 pm #74429puppycirclesParticipant
I do not know where to find the category ID. I have created a parent category “vendor memberships”. Are you referring to the product IDs for the products within that category? Currently the only product under that parent category is “basic vendor memberships: with an ID:471. Is this what you are referring to?
- July 30, 2019 at 3:49 am #74460puppycirclesParticipant
Okay, I found the category ID: cat&tag_ID=197
Sorry, I am new to this and learning as I go.
Thanks again for you help!
- July 31, 2019 at 8:06 pm #74655puppycirclesParticipant
Sorry, Just following up on this request…
Thanks!
- August 3, 2019 at 5:34 am #74926WCFM ForumMember
HI,
I found the category ID: cat&tag_ID=197
– What category you have created? Post or Product?
You have to create “Product Category” and then edit that and you will see like this – https://ibb.co/VW0Q6KM
Thank You
- August 5, 2019 at 3:30 am #75240puppycirclesParticipant
I have created a product category “vendor memberships”: wp-admin/term.php?taxonomy=product_cat&tag_ID=197&post_type=product&wp
Thanks!
- August 8, 2019 at 3:56 pm #75786WCFM ForumMember
Hi,
Here is your modified code for the purpose –
add_filter( 'woocommerce_is_purchasable', function( $is_purchasable, $product ) { $pcategories = get_the_terms( $product->get_id(), 'product_cat' ); if( !empty($pcategories) ) { foreach($pcategories as $pkey => $pcategory) { if( absint($pcategory->term_id) == 197 ) { $is_purchasable = false; } } } return $is_purchasable; }, 500, 2 );
Thank You
- August 9, 2019 at 6:02 am #75865puppycirclesParticipant
Thank you,
Unfortunately the code did not work the way I hoped. Vendor products are still purchasable in product pages and the vendor membership was not purchasable.
Can we talk about customized work.
Attachments:
You must be logged in to view attached files. - August 12, 2019 at 8:52 am #76207WCFM ForumMember
Hi,
Please use this modified code –
add_filter( 'woocommerce_is_purchasable', function( $is_purchasable, $product ) { $is_purchasable = false; $pcategories = get_the_terms( $product->get_id(), 'product_cat' ); if( !empty($pcategories) ) { foreach($pcategories as $pkey => $pcategory) { if( absint($pcategory->term_id) == 197 ) { $is_purchasable = true; break; } } } return $is_purchasable; }, 500, 2 );
Thank You
- August 17, 2019 at 4:55 am #77020puppycirclesParticipant
Thank You for the modified Code! IT WORKS!
- August 20, 2019 at 8:12 am #77459WCFM ForumMember
You are always welcome 🙂
Let me know if there’s anything else we can help you with.
Can we ask for a favor? Would you mind taking a few minutes to review our plugin at https://wordpress.org/support/plugin/wc-multivendor-marketplace/reviews/ and let others know about your 5 Star experience with WCFM Marketplace. Also, follow us on Twitter https://twitter.com/wcfmmp for more exciting news, important updates, and irresistible offers. - August 21, 2019 at 4:27 am #77586puppycirclesParticipant
Done! Thanks again,
Zeke
PuppyCircles.com - August 22, 2019 at 5:08 pm #77828WCFM ForumMember
Thank you very much and have a great day 🙂
- AuthorPosts
- The topic ‘Removing "Add to Cart" from Category Page’ is closed to new replies.