Dawn 8 / Quick Add Button / Exclude products from some collections

Hi!

My site OurHatsDeserveBetter.com sells bespoke hatbands. For some of my collections, products are already composed (illustration: https://ourhatsdeservebetter.com/collections/past-and-present-high-fashion-paphat-hatbands-collection ) and a quick add buttons make sense and is desirable. For some others (illustration https://ourhatsdeservebetter.com/collections/ruban-de-chapeau-pahhat-multi-couleurs-tissus ), the products are to be composed by the customer and therefore quick add buttons do not make sense. Would there be a way to exclude quick add buttons for products from selected collections?

Best

Eric

@bibigab you need customize code to add quick add button .(You can take anyone help cause dawn theme doesn’t provide that feature btw i can help you dm me)

Thanks but wrong: Dawn provides for quick add buttons in the product grid. My problems is that features applies to all collections

Yes, it’s possible to exclude the Quick Add buttons for products from selected collections on your Shopify store. To achieve this, you would need to modify the code of your product template or collection template. Here’s a general outline of the steps involved:

  1. Identify the product template or collection template being used for your store. This could be a Liquid file with a .liquid extension, such as product.liquid or collection.liquid.
  2. Open the relevant template file in your Shopify theme editor or code editor.
  3. Locate the code responsible for displaying the Quick Add button. This code may vary depending on your theme and customization.
  4. Surround the Quick Add button code with a conditional statement that checks the collection handle or ID. You can retrieve the collection information using Liquid variables or Shopify’s API.
  5. Within the conditional statement, include the Quick Add button code only if the product does not belong to the excluded collections. Otherwise, exclude the Quick Add button code or display an alternative option.

Here’s a simplified example of what the modified code could look like:

{% if collection.handle != 'excluded-collection-handle' %}
  
{% endif %}

First, tks !

Second, apologies if I say anything stupid but codes look life hieroglyphs…

The line you suggested, is it to restrict the quick add button to the listed collections (looks like it to me?) Or to exclude them ?

In main-collection-products-grid.liquid, I have the following lines :

{% render ‘card-product’,
card_product: product,
media_aspect_ratio: section.settings.image_ratio,
show_secondary_image: section.settings.show_secondary_image,
show_vendor: section.settings.show_vendor,
show_rating: section.settings.show_rating,
lazy_load: lazy_load,
show_quick_add: section.settings.enable_quick_add,
section_id: section.id

Should I includes the code on exclusion there :

{% render ‘card-product’,
card_product: product,
media_aspect_ratio: section.settings.image_ratio,
show_secondary_image: section.settings.show_secondary_image,
show_vendor: section.settings.show_vendor,
show_rating: section.settings.show_rating,
lazy_load: lazy_load,
{% if collection.handle != ‘== ‘paphat-hatbands-ready-composed-on-our- shelves’ or collection.handle == ‘past-and-present-high-fashion-paphat- hatbands-collection’ or collection.handle == ‘paphat-hatband-special-editions’’ %}

show_quick_add: section.settings.enable_quick_add,

{% endif %}
section_id: section.id

I finally sorted it out with a bit of additional help from chat GPT. I made the changes in card-product.liquid :

{%- assign excluded_collections = ‘paphat-hatbands-ready-composed-on-our-shelves,past-and-present-high-fashion-paphat-hatbands-collection,paphat-hatband-special-editions’ | split: ‘,’ -%}

{%- if show_quick_add and excluded_collections contains collection.handle -%}

{%- else -%}