Demo index

Custom line item properties

PreProduct can add extra Shopify line item properties to your cart and resulting orders. This works for both mixed and isolated redirects.

2 min read

Still stuck?

Ask the docs AI anything, or talk to the team. We usually reply within a few hours.

Contact us

Adding custom line item properties to pre-orders

To add custom properties, set the ppCustomLineItemProperties variable on the window object. This must be a JavaScript object. Here’s how:

Setting additional Shopify line item properties
window.ppCustomLineItemProperties = {
  "preorders_are": `great`
}

Adding line item properties from customer input

Sometimes Shopify product pages have form fields for the customer to fill in which are submitted as line item properties. Below is a snippet that you can copy and paste into your theme’s product page to include these on pre-orders.

markup

<script>
	window.addEventListener('ppCartSessionTransactionReady', (e) => {
		const inputs = document.querySelectorAll('input[name*="properties"]');

		inputs.forEach((input) => {
			const name = input.name.replace("properties[", "").replace("]", "")
			e.detail.itemAddition.properties[name] = input.value;
		});
	});
</script>

The built-in _preorder property

Separately from custom properties, PreProduct automatically adds a hidden line item property to every pre-order line at add-to-cart time: a key of _preorder with a value of "true". The leading underscore keeps it hidden from customers, and unlike custom properties the key is fixed — it can’t be renamed or removed. See Shopify pre-order tags and line-item properties for the full story on using it to detect pre-orders programmatically.

Screen walkthroughs

Pre-sell With PreProduct

7 day free trial with all plansMigrate pre-orders