Add line items
Add variants and extras to a customer's cart.
To add items to a customer's cart, use the create_line_item form tag.
At a minimum, each line item must include the ID of the variant or extra being added.
Basic usage
{% for variant in product.variants %}
{% form "create_line_item" %}
<input type="hidden" name="items[][variant_id]" value="{{ variant.id }}" />
<input type="submit" value="Add to cart" />
{% endform %}
{% endfor %}Line item properties
Additional fields can be included depending on the type of product being booked.
Quantity
Specify the number of units to add to the cart.
<input
type="hidden"
name="items[][quantity]"
value="2"
/>If omitted, a quantity of 1 is used.
Modifier selections
If a variant or extra includes pre-checkout modifier groups, the selected modifiers must be submitted with the form.
<input
type="hidden"
name="items[][modifier_ids][]"
value="<modifier_id>"
/>If a required modifier selection is omitted, the item will not be added to the cart.
Adult count
Per unit variants support occupancy-based pricing.
Specify the number of adults using:
<input
type="hidden"
name="items[][adult_count]"
value="2"
/>If omitted, the variant's maximum occupancy is used.
Experience slot
Experience variants require a slot ID to book a specific date or time.
<input
type="hidden"
name="items[][experience_slot_id]"
value="{{ experience_slot.id }}"
/>Accommodation dates
Accommodation variants require both a check-in and check-out date.
Dates must use the format YYYY-MM-DD.
<input
type="hidden"
name="items[][start_on]"
value="2026-07-15"
/>
<input
type="hidden"
name="items[][end_on]"
value="2026-07-18"
/>Clear the cart first
To remove all existing cart items before adding the new line items, include the clear_cart field.
<input type="hidden" name="clear_cart" />This is useful when building booking flows that should only contain a single booking at a time.
Developer considerations
When adding line items:
- Always include a
variant_id(or extra ID). - Include
quantitywhen adding more than one item. - Include all required modifier selections for variants and extras.
- Specify
adult_countfor occupancy-based pricing where appropriate. - Experience variants must include an
experience_slot_id. - Accommodation variants must include both
start_onandend_on. - Use
clear_cartwhen the booking flow should replace any existing cart contents.