smootify:changed_option
the visitor changed an option of a product (not at the first render)
On this page
the visitor changed an option of a product (not at the first render) Since 1.x.
Listen
window.Smootify = window.Smootify || [];
window.Smootify.push((api) => {
api.on("changed_option", (payload) => {
// …
});
});Payload
{ optionChangedIndex: number; variant?: ProductVariant; selectedValue: string; variants: ProductVariant[]; product?: Product; }ProductVariant
export interface ProductVariant {
/** `gid://shopify/ProductVariant/<id>` */
id: string;
title: string;
sku: string | null;
barcode: string | null;
availableForSale: boolean;
currentlyNotInStock: boolean;
quantityAvailable: number | null;
weight: number | null;
weightUnit: string;
price: Money;
compareAtPrice: Money | null;
unitPrice: Money | null;
quantityRule: QuantityRule;
image: { id: string | null; url: string; altText: string | null } | null;
selectedOptions: SelectedOption[];
sellingPlanAllocations: { nodes: { sellingPlan: { id: string } }[] };
metafields: (Metafield | null)[];
}Product
export interface Product {
/** `gid://shopify/Product/<id>` */
id: string;
title: string;
handle: string;
vendor: string;
productType: string;
descriptionHtml: string;
tags: string[];
isGiftCard: boolean;
requiresSellingPlan: boolean;
totalInventory: number | null;
category: { name: string } | null;
publishedAt: string;
createdAt: string;
metafields: (Metafield | null)[];
collections: { nodes: { handle: string; title: string; image: { url: string } | null }[] };
media: { nodes: ProductMedia[] };
options: ProductOption[];
sellingPlanGroups: { nodes: SellingPlanGroup[] };
/** every variant on the product page; the first 250 elsewhere */
variants: { nodes: ProductVariant[]; pageInfo: { hasNextPage: boolean; endCursor: string | null } };
}