Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello,
I used https://ui-elements-generator.myshopify.com/pages/line-item-property to create custom line items on some of my products. To do this, I went to Online Store > Customize and added the line items as Custom Liquid on the product page. However, I cannot get the custom line items to show up in the cart or in the admin panel when an order is placed. I feel like I've looked through every tutorial and discussion about this topic, but with no success. From what I've gathered, I need to add code to either cart.json or main-cart-items.liquid, but I can't figure out what to add or where. Has anyone successfully added custom line items to the Craft theme?
Solved! Go to the solution
This is an accepted solution.
For anyone else who might end up with this issue, all I needed to do was to add this line to the very beginning of each of the custom liquid blocks:
{%- assign product_form_id = 'product-form-' | append: section.id -%}
Probably need to add the form attribute to the inputs that targets the ID of the main products buy-button form it's something like {%- assign product_form_id = 'product-form-' | append: section.id -%}
<input form="{{product_form_id }}">
https://github.com/Shopify/dawn/blob/main/sections/main-product.liquid#L69
That's IF IF the custom-liquid is a block within the main product section, if it's a separate custom-liquid section the form ID will have to be figured out.
Beyond that, Keep always in mind others do not see what you see or know what you know.
Always provide relevant context so others can understand, inspect or reproduce issues.
Context such as: For theme problems always provide store url or preview urls, exact demo urls, storefront password if any, theme name, example code, are any apps involved , etc.
https://community.shopify.com/c/shopify-design/help-us-help-you/td-p/668159
Good Luck.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Locate the cart template files: In the theme editor, look for the "Cart" or "Cart Template" section. You may find multiple cart-related template files such as "cart.liquid", "cart-template.liquid", or similar. The exact file name may vary depending on your theme.
Edit the cart template file:
Retrieve and display custom line items:
line_item.properties
or line_item.custom_properties
.This is an accepted solution.
For anyone else who might end up with this issue, all I needed to do was to add this line to the very beginning of each of the custom liquid blocks:
{%- assign product_form_id = 'product-form-' | append: section.id -%}
In Canada, payment processors, like those that provide payment processing services t...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025