Custom code to remove quantity selector on all products priced at $0.00? Using Dawn theme.
Can you please share you store’s URL ?
@Hayes1234 hey, thanks for posting here.
can you please share the link to inspect it, thanks.
or put this condition on the quantity selector :
{% assign product_price = product.price | money_without_currency | replace: ',', '' | plus: 0 %}
{% if product_price > 0 %}
{% endif %}
Hi @Hayes1234
In sections/main-product.liquid file
Replace
{% 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 -%}
To
{% if product.price > 0 %}
{% 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 -%}
{% endif %}
You will find it here
I hope, it will help you
Thanks!
