2.0 Beta

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

What changed

metafield_definitions

The metafields the products and the cart ask Shopify for, for each kind of `[metafield]` element on the page (add the ones a script reads, remove the ones nobody shows). Synchronous: it cannot stop, and an error it throws is logged and the filter skipped.

v2.0 beta
Open .md
On this page
  1. Types
  2. MetafieldIdentifier
  3. MetafieldDefinitionsContext

The metafields the products and the cart ask Shopify for, for each kind of [metafield] element on the page (add the ones a script reads, remove the ones nobody shows). Synchronous: it cannot stop, and an error it throws is logged and the filter skipped.

Add it with Smootify.addFilter: answer the value changed, nothing to keep it, or false to stop.

metafield_definitions: ( definitions: MetafieldIdentifier[], context: MetafieldDefinitionsContext, ) => MetafieldIdentifier[] | undefined

Types

MetafieldIdentifier

export interface MetafieldIdentifier {
  namespace: string;
  key: string;
}

MetafieldDefinitionsContext

/** Who asks for the definitions, with the attribute and the selector of those elements. */
export interface MetafieldDefinitionsContext {
  /**
   * What asks for the definitions: the products (`[metafield]` in `smootify-product`), their variants
   * (`[variant-metafield]`) or the products of the cart lines (`[metafield]` in `cart-item`).
   */
  scope: "product" | "variant" | "cart";
  attribute: "metafield" | "variant-metafield";
  selector: string;
}

    ↑ ↓ to moveEnter to openEsc to close