I need to add an age restriction checkbox to one product on my Shopify store. I only have one product that requires this checkbox when added to cart, or when checking out. Is it possible to add this checkbox to a single product?
@DataStory , yes it’s possible. ![]()
Please share url of that product.
Hello @DataStory ,
Hope you are doing well!
I have gone through your problem and would like to assist you with the same. Please feel free to reach me at prachi.verma-int@zehntech.com.
I have sent you the PM. kindly check.
Thanks,
Prachi
Thank you. The product URL is https://safenight.nz/products/six-pack-of-tiny
@DataStory go to edit code > sections > main-product.liquid.
Find this element (probably line 425 - but you have to check):
{%- form 'product', product, id: product_form_id, class: 'form', novalidate: 'novalidate', data-type: 'add-to-cart-form' -%}
{%- if block.settings.show_dynamic_checkout -%}
{{ form | payment_button }}
{%- endif -%}
{%- endform -%}
Replace it with:
{%- form 'product', product, id: product_form_id, class: 'form', novalidate: 'novalidate', data-type: 'add-to-cart-form' -%}
{% if product.url == '/products/six-pack-of-tiny' %}
{% else %}
{% endif %}
{%- if block.settings.show_dynamic_checkout -%}
{{ form | payment_button }}
{%- endif -%}
{%- endform -%}
This should work.
It worked - thanks so much for your help!
Hi Marina, I have brought back the Add to Cart button in my store and now the code isn’t working. Sorry to ask again, but is there something I need to change to be able to add this to cart? Thanks ![]()
Hi @DataStory code that you have is related to this product only https://safenight.nz/products/six-pack-of-tiny . You asked for it - when I open this url now it’s 404 page. Have you deleted this product?
Hi @MarinaPetrovic , yes this worked perfectly but then I had to add back in my Cart, and it has stopped. It is still just for that product. The product isn’t live yet so I had to turn it off but I can turn it back on now if you’re able to have a look for me
Thank you!