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.
On this page
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[] | undefinedTypes
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;
}