I’m using Dawn 9.0 and I know to add the line item code in buy-buttons.liquid in the Snippet folder for it to show in the cart. My problem is my products do not all have the same line item properties and some do not need line items at all. Where would I put the code for my other products?
You either need to add conditional logic so the line-item-properites(LIPs) are only added for specific products.
Or make an alternate template for those specific products with a custom-liquid section containing the LIPs code with a form attribute whose value matches the id of the buy-buttons form.
{%- assign product_form_id = 'product-form-' | append: section.id -%}
Re-made product_form_id variable for completeness, the value of product_form_id should come from this line in dawn:
https://github.com/Shopify/dawn/blob/main/sections/main-product.liquid#L69
Used here in the buy button form https://github.com/Shopify/dawn/blob/main/snippets/buy-buttons.liquid#L45
If you need this customization done , contact me directly for services.
Please provide context, examples: store url, theme name, post url(s) , or any further detail.
Contact Info in signature.
Hello @dsburton4 ,
You can try to follow these steps:
- Go to Online Store → Themes → Actions → Edit code
- Go to Sections folder → product-template.liquid file
- Find the code that begins with: .
- Just above this code, add the following line: {% include ‘product-line-item-properties’ %}
- Save changes
Hope this can help. Let us know if you need any further support