Removing "Add to Cart" from Category Page

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Feature Request Removing "Add to Cart" from Category Page

Viewing 19 reply threads
  • Author
    Posts
    • #73758
      puppycircles
      Participant

      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.
    • #73789
      puppycircles
      Participant

      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

    • #73889
      WCFM Forum
      Keymaster

      Hi,

      Please add this line to your site –

      add_filter( 'woocommerce_is_purchasable', '__return_false' );

      Thank You

    • #73922
      puppycircles
      Participant

      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!

    • #73996
      WCFM Forum
      Keymaster

      Hi,

      This is off course possible. Please know me that category ID. I will change code accordingly.

      Thank You

    • #74058
      puppycircles
      Participant

      Thank you! The only category I want to be purchasable is “Vendor Memberships”

    • #74373
      WCFM Forum
      Keymaster

      Understand. Create such a category and know me it’s ID.

    • #74392
      puppycircles
      Participant

      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!

    • #74429
      puppycircles
      Participant

      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?

    • #74460
      puppycircles
      Participant

      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!

    • #74655
      puppycircles
      Participant

      Sorry, Just following up on this request…

      Thanks!

    • #74926
      WCFM Forum
      Keymaster

      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

    • #75240
      puppycircles
      Participant

      I have created a product category “vendor memberships”: wp-admin/term.php?taxonomy=product_cat&tag_ID=197&post_type=product&wp

      Thanks!

    • #75786
      WCFM Forum
      Keymaster

      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

    • #75865
      puppycircles
      Participant

      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.
    • #76207
      WCFM Forum
      Keymaster

      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

    • #77020
      puppycircles
      Participant

      Thank You for the modified Code! IT WORKS!

    • #77459
      WCFM Forum
      Keymaster

      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.

    • #77586
      puppycircles
      Participant

      Done! Thanks again,

      Zeke
      PuppyCircles.com

    • #77828
      WCFM Forum
      Keymaster

      Thank you very much and have a great day 🙂

Viewing 19 reply threads
  • The topic ‘Removing "Add to Cart" from Category Page’ is closed to new replies.