i want to show add to cart button in dawn theme, i have added the button but i also want to show cart quantity for each product, like product page. i am attaching product page screenshot, i want same thing for collection page
the highlighted part implement on collection page
Hello @noirandblanco ,
If you want to add a quantity selector on the collection page, please follow the steps below:
- Navigate to Online Store → Themes → Edit code.
- Search for the file “card-product.liquid”.
- Search form ‘product’ onwards and paste the code provided.
{% comment %} TODO: enable theme-check once `item_count_for_variant` is accepted as valid filter {% endcomment %}
{% # theme-check-disable %}
{%- assign cart_qty = cart | item_count_for_variant: product.selected_or_first_available_variant.id -%}
{% # theme-check-enable %}
{%- liquid
assign volume_pricing_array = product.selected_or_first_available_variant.quantity_price_breaks | sort: 'quantity' | reverse
assign current_qty_for_volume_pricing = cart_qty | plus: product.selected_or_first_available_variant.quantity_rule.min
if cart_qty > 0
assign current_qty_for_volume_pricing = cart_qty | plus: product.selected_or_first_available_variant.quantity_rule.increment
endif
-%}
{%- if product.quantity_price_breaks_configured? -%}
{%- endif -%}
{%- if product.selected_or_first_available_variant.quantity_rule.increment > 1 -%}
{{-
'products.product.quantity.multiples_of'
| t: quantity: product.selected_or_first_available_variant.quantity_rule.increment
-}}
{%- endif -%}
{%- if product.selected_or_first_available_variant.quantity_rule.min > 1 -%}
{{-
'products.product.quantity.minimum_of'
| t: quantity: product.selected_or_first_available_variant.quantity_rule.min
-}}
{%- endif -%}
{%- if product.selected_or_first_available_variant.quantity_rule.max != null -%}
{{-
'products.product.quantity.maximum_of'
| t: quantity: product.selected_or_first_available_variant.quantity_rule.max
-}}
{%- endif -%}
{%- if product.quantity_price_breaks_configured? -%}
{%- endif -%}
- Finally, go to the bottom of the file and paste the code.