2.0 Beta

Smootify 2.0 is in public beta. Your 1.x store keeps working. Move when you want.

What changed

smootify-add-to-cart

Product form that turns the selection into cart lines.

v2.0 beta
Open .md
On this page
  1. Where it can go
  2. What it requires
  3. Fields in the form
  4. Attributes on the element
  5. Attributes inside it
  6. Loading

Where it can go

  • Inside smootify-product.
  • Must contain form.
  • Out of place, Smootify removes it from the page.

What it requires

Nothing beyond Smootify: it works on every plan.

Fields in the form

Each field’s name attribute tells Smootify what the field holds.

NameFieldWhat it does
quantityinput type="number" (quantity-input)The quantity of the line.
sellingPlanIdinput type="radio", select (written by subscription-swatches)The selling plan of the line.
option1, option2, option3selectA bare select[name="optionN"] picks that option; never a line property.
Recipient emailinput type="email"Gift card: Shopify sends the card to this address.
Recipient nameinput type="text"Gift card: the recipient’s name, in the email Shopify sends with the card (with a filled Recipient email).
Messageinput type="text", textareaGift card: the message in that email.
Send oninput type="date"Gift card: the day the card is sent (Smootify sets today as the minimum).
buy-now (submit button)buttonThe line goes straight to checkout.
any Name on a field of an add-on widget (addon-checkbox, addon-select, addon-dropdown, addon-popover, addon-swatches, the add-on’s quantity-input)any fieldNever a property of the main line, whatever the Name. From mount the widget names its fields ##ignore-addon, left out of the line; once the add-on’s product loads they get the names of the add-on line (2.0). The add-on’s quantity-input: the quantity per unit of the main product, so the add-on’s line and the form’s total take it times the main quantity and follow it (2.0); with quantity="total" on the picker the add-on’s total, not multiplied (2.0). Without one the add-on follows the main quantity. 1.x’s addon-type is ignored (the debugger points it out). Any add-on widget puts the form in box mode (use-magic-box, as 1.x): main line and add-ons go in as one box, and the box’s quantity is not changed in the cart; separate add-on lines (a default line of its own, a bundle grouped and scaled by _bundledQuantity) come only from #addon|… fields written by hand, without widgets.
any other name, or properties[Name]any fieldA line item property named as the field’s data-name; a checkbox with data-name sends its data-value, else ✓; a file is sent as JSON; empty values are not sent; a name starting with _ is hidden at checkout and in the cart.

Attributes on the element

  • It reads use-magic-box, box-title, box-image, single-addon-swatch, allow-unavailable, avoid-option-update.

Attributes inside it

GroupAttribute nameValues
Add to cartbundle8
Add to cart (condition)condition3

Loading

Defined at boot on every page.

    ↑ ↓ to moveEnter to openEsc to close