Theme guide

Shopify line item properties generator: custom fields without an app

What you’ll need

  • The theme editor (to add a Custom Liquid block; no code editing)

    How to get this: The theme editor
    1. Online Store › Themes › Edit theme (on a copy of your theme if you want to test first).
    2. Add section or Add block › Custom Liquid, paste the code, then Save.

    Step-by-step guide (opens in a new tab)

  • Your settings for the feature (for example your free shipping amount or countdown end date)

Make my custom fields

What you can add

  • One line of text with a character limit, like a name to engrave.
  • A text box for a gift message.
  • A dropdown or choice buttons, like a font or a thread color.
  • A checkbox, like “Add a gift note”.
  • A date, with the earliest date shoppers can pick.
  • A file upload for a photo or logo (JPG, PNG or PDF).

Add the fields

  1. Open the Liquid Snippet Studio and choose Custom fields (personalization).
  2. Pick every product or only products with a tag, then set up to three fields: label, kind, choices and whether it’s required.
  3. In Online Store › Themes › Customize, open Products › Default product.
  4. In Product information, click Add block › Custom Liquid and paste the code. Drag it above the Buy buttons block.
  5. Save, then add a product to the cart: the answers show under the item in the cart.

Why copied code often doesn’t save the answer

In Dawn and Horizon a Custom Liquid block sits outside the theme’s product form, so an input pasted there is never sent with Add to cart. Our fields tie themselves to the theme’s form with the form attribute, so they’re sent wherever you place the block.

Dawn’s product form also has novalidate, so the browser never checks the required attribute. The generated code checks required fields itself and shows a message under the field.

Where the answers show up

  • In the cart and cart drawer, under the product name (Dawn and Horizon do this already).
  • At checkout and on the order in Shopify admin.
  • Not on packing slips or in the order confirmation email by default. The guides below show the one-line changes.
  • Labels that start with an underscore (_like_this) are hidden in the cart, so our generator doesn’t allow them.

How it behaves

  • Works in Dawn 16.2.0 and Horizon 4.5.0.
  • Add to cart with a required field empty is blocked with “Please fill in Engraving text.” and nothing is added.
  • Filled in, the cart line carries each field as a property (for example Engraving text, Font and Your photo). An uploaded photo becomes a cdn.shopify.com/…/uploads/ link, and the cart page lists every property under the item.
  • Empty optional fields are left out, so the order shows no blank lines.

Good to know

  • “Buy it now” buttons can skip the required check, so the generator can hide them on products with fields.
  • Uploaded files are stored by Shopify and linked on the order.
  • Properties don’t change the price. For a paid add-on, add a separate product such as a gift wrap item.
  • It goes in a Custom Liquid block in the theme editor, so no theme file is edited. Theme updates keep it, and deleting the block removes it completely.

Questions

Is this the same as the old Shopify UI Elements generator?

It does the same job: generates line item property fields. Shopify retired its generator; ours adds required checks, character counters and conditional fields, and is tested on Dawn and Horizon.

Can a field show only after another choice?

Yes. Fields 2 and 3 can show only when field 1 has a set answer, like a font choice that appears after “Add engraving” is ticked.

More guides