2.0 Beta

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

What changed

Show metaobjects

Load metaobjects from Shopify straight into Webflow, without the CMS. Covers a paged list of one type, the metaobjects of a product metafield, a single entry, and how their fields show.

v2.0 beta
Open .md1.x page ↗
On this page
  1. 1. A list of one type
  2. 2. The metaobjects of a product or a customer
  3. The logged-in customer’s entries
  4. 3. One entry
  5. 4. Show the fields
  6. 5. Product cards from a field
  7. Before you publish

Metaobjects are structured content you keep in Shopify, such as testimonials, size charts, FAQs or store details. Smootify shows them on the site without the Webflow CMS: you design one entry, and Smootify fills it and repeats it. Your client can then edit that content in Shopify, next to the products. This page covers a list of entries, the entries of a product, and a single entry.

Note

In Shopify, under Settings > Custom data > Metaobjects, the definition must have Storefronts access turned on. Without it, the entries never reach the site. With Active-draft status also turned on, entries saved as draft stay off the site until you make them active.

Three ways to load them, each a section below:

smootify-metaobjects

A list of one type

Needs
data-type, the definition's type.
Pages
Yes: data-limit entries at a time.
smootify-metaobjects

The metaobjects of a product

Needs
data-type: metafield. and the metafield's namespace and key. data-product-id.
Pages
Yes, like a list of one type.
smootify-metaobject

One entry

Needs
data-type and data-handle, or data-id.
Pages
No. When the entry does not exist, the element is removed.

Two names you need from Shopify. The type of the definition, such as testimonial, shown on the definition’s page. And the key of each field, such as author_name for a field called “Author name”. Here they are on a testimonial definition, with its entries and what the page shows:

1 Settings › Custom data › Metaobjects › Testimonial

TestimonialMetaobject definition
Typetestimonial

Fields

Author nameauthor_nameSingle line text
QuotequoteMulti-line text
PhotophotoFile
Storefronts access
Active-draft status

2 Content › Metaobjects › Testimonial

Entries3
Anna R.Fits perfectly, great linen.Active
Marco B.Arrived in two days.Active
Lena K.Lovely color.Draft

A draft stays off the site until you make it active.

3 In Webflow, inside smootify-metaobject

metaobject="author_name"Anna R.
metaobject="quote"“Fits perfectly, great linen.”
metaobject="photo"

The key, not the field's name: “Author name” is author_name.

1. A list of one type

Add a Custom element with the tag smootify-metaobjects and give it the custom attribute data-type with the type. Inside it, add a Custom element with the tag smootify-metaobject: the template of one entry.

Example structure of the Navigator
smootify-metaobjectsCustom Elementdata-type=testimonialdata-limit=6
Div Block
smootify-metaobjectCustom Element
Text Block“Name”metaobject=author_name
Text Block“Quote”metaobject=quote
empty-stateCustom Element
Text“No testimonials yet”
buttonCustom Elementdata-action=load-more
Text“Load more”
  • The template. Smootify copies the first smootify-metaobject once per entry, and removes the others you designed. The copies go next to it, so put it in a Div block you style as a grid or a list.
  • data-limit sets how many entries load at a time, 10 by default.
  • Pages. Custom elements with the tag button and data-action="next" or data-action="prev" show the next or the previous page in place of the current one. data-action="load-more" adds the next entries under the ones shown. Use next and previous, or load more, not both. Each button is hidden when there is no page to go to.
  • Nothing to show. A Custom element with the tag empty-state shows while the list is empty.

While it works, smootify-metaobjects has the classes is-loaded, is-empty, has-next and has-prev, which you can style as combo classes. See metaobject list attributes.

2. The metaobjects of a product or a customer

A product metafield that is a list of metaobjects, such as custom.features, can feed the same list. On the product page:

  • set data-type to metafield. followed by the metafield’s namespace and key, such as metafield.custom.features;
  • add data-product-id, bound to the Shopify ID field of the Products collection.
Example structure of the Navigator
smootify-metaobjectsCustom Elementdata-type=metafield.custom.featuresdata-product-id=Shopify ID
smootify-metaobjectCustom Element
Text Block“Feature”metaobject=title

It pages like a list of one type. For a few entries without pages, a metafield attribute on the product page also repeats them: see Metafields on the page.

The logged-in customer’s entries

The entries a customer created with a metaobject creator that has customer-field, such as their gift lists, are in the customer’s metafield smootify.<type>. On an account page, set data-type to metafield.smootify.gift_list and data-parent-id to customer:

Example structure of the Navigator
smootify-metaobjectsCustom Elementdata-type=metafield.smootify.gift_listdata-parent-id=customerdata-limit=12
Div Blockclass=grid
smootify-metaobjectCustom Element
Text Block“Occasion”metaobject=occasion
HeadingH3“List title”metaobject=title
Text Block“Date”metaobject=date
Text Link“Open the list”Link “/gift-list”data-handle-param=l
empty-stateCustom Element
Text“No gift lists yet”
  • The newest entry comes first. An entry deleted in Shopify is skipped.
  • A visitor who is not logged in, or a customer with no entry yet, sees the empty-state, and the list has is-empty.
  • A link with data-handle-param inside the card links to that entry’s page, such as /gift-list?l=<handle>.

3. One entry

Use a smootify-metaobject on its own, outside any list, with the custom attributes data-type and data-handle, the handle of the entry in Shopify. You can bind data-handle to a CMS field, for example to show a different size chart on each product page. data-id, with the entry’s id, works instead of the handle.

Example structure of the Navigator
smootify-metaobjectCustom Elementdata-type=size_chartdata-handle=shirts
HeadingH2“Size chart”metaobject=title
Imagemetaobject=image
Div Blockif-metaobject=notes
Text Block“Notes”metaobject=notes

When the entry does not exist, the element is removed.

The entry named in the page link. With data-handle-param, the handle comes from the page’s URL: data-handle-param="l" on the page /list?l=giulia-birthday shows the entry giulia-birthday. One page in the Designer then shows every entry a form creates, such as a shared gift list, a saved configuration or a quote, with no CMS page for each. data-id and data-handle stay the fallback when the link has no parameter; without one, or with a handle that does not exist, the element is removed.

Example structure of the Navigator
Div Blockclass=list
smootify-metaobjectCustom Elementdata-type=gift_listdata-handle-param=l
HeadingH1“Gift list”metaobject=title
Text Block“Message”metaobject=message
Text Block“This list does not exist.”class=not-found

To show a message when the entry is not found, style it hidden and show it once the element is gone, with a custom code rule such as .list:not(:has(smootify-metaobject)) .not-found { display: block; }. Anyone with the link can read the entry, so keep emails and addresses out of it. Create the metaobject definition without a display name field: Shopify then gives every entry a random handle, and nobody can guess the link of another one.

4. Show the fields

Inside a smootify-metaobject, metaobject="key" shows that field. Every field type renders, as metafields do: text, rich text, numbers, colours, dates, images and other files, links, lists, and references to products or to other metaobjects. A field without a value hides its element.

  • Images take the size attributes max-width, max-height, crop and pad-color: see image size.
  • Modifiers work as on metafields: data-attr, data-digits, property, separator, and data-path for a JSON field. See Metafields on the page.
  • Conditions. if-metaobject="key" shows an element only when the field has a value, and unless-metaobject="key" only when it has none. Add data-check-value to compare with a value. See metaobject conditions.
  • Loading. Elements with skeleton shimmer until the entry is filled.
  • Languages. Entries come in the page’s language and the visitor’s market: an entry translated in Shopify, for example with Translate & Adapt, shows translated. See Markets, currencies and languages.

How each type renders is in metafield types. The attributes are in metaobject attributes.

5. Product cards from a field

metaobject="key" on a product reference field shows the product’s title, image and link. For full product cards, with price, options, add to cart and wishlist, put a smootify-product with data-id="metaobject.<key>" inside the smootify-metaobject, where <key> is a product reference field or a list of product references of the entry. Design it as one card: Smootify repeats it once per product, in the field’s order.

Example structure of the Navigator
smootify-metaobjectCustom Elementdata-type=gift_listdata-handle-param=l
HeadingH2“List title”metaobject=title
Div Blockclass=grid
smootify-productCustom Elementdata-id=metaobject.products
Text Block“Product title”product=title
smootify-priceCustom Element
Text Span“$0.00”data-prop=price
smootify-add-to-cartCustom Element
Text“…”
  • Where it works. Inside a smootify-metaobject: on its own, opened from the page link with data-handle-param, or in each card of a smootify-metaobjects list, each entry with its own products. Outside one, Smootify removes the card.
  • An empty field removes the card. A product the visitor’s market does not sell hides, as in any product list.
  • A class to style. html and body get has-metaobject-<key> when the field has products.
  • In a slider, the card fills the slider like the other product sources.

How many are wanted and how many are taken. When the entry keeps a quantity for each product in a JSON field, such as the quantities of a gift list made with quantities, add to the card data-requested with that field’s key. data-fulfilled names a second JSON field with what is already taken, such as gifted, which the Shopify Flow Gift list: count the gifts fills when an order is paid. Inside the card:

  • metaobject-quantity="requested", metaobject-quantity="fulfilled" and metaobject-quantity="left" show the numbers, for “2 of 6 gifted” or “4 left”;
  • the card gets is-partially-fulfilled while some are taken, then is-fulfilled when none is left, and its add to cart is disabled;
  • the card’s quantity cannot go above what is left;
  • a sold-out product still shows as sold out.
Example structure of the Navigator
smootify-productCustom Elementdata-id=metaobject.productsdata-requested=quantitiesdata-fulfilled=gifted
Text Block“Product title”product=title
Div Block
Text Span“0”metaobject-quantity=fulfilled
Text“of”
Text Span“1”metaobject-quantity=requested
Text“gifted”
buttonCustom Elementtype=buttondata-is=direct-add-to-cart
Text“Add to cart”

Before you publish

Check these first

  • The list disappears. It has no data-type or no smootify-metaobject inside, or, for a product list, no data-product-id.
  • The list stays empty. The definition does not have Storefronts access, or data-type is not the definition’s type.
  • A field stays empty. metaobject has the field’s name instead of its key: “Author name” is author_name.
  • Some entries are missing. They are saved as draft in Shopify. Make them active.
  • A single entry disappears. Its handle or its type is wrong, so Shopify finds no entry.

    ↑ ↓ to moveEnter to openEsc to close