id
description_html
descriptionHtml
variants
price
compare_at_price
title
window.tolstoyWidget.postMessage({ product: { id: "prod_123", variants: [ { id: "var_2", // Second variant price: 29.99, }, ], }, eventName: "tolstoy_product_update", });
window.tolstoyWidget.postMessage({ product: { id: "prod_123", title: "Updated Product Title", description_html: "<p>New product description</p>", variants: [ { id: "var_1", // Include first variant even if unchanged }, { id: "var_2", price: 29.99, // Your update here }, { id: "var_3", // Include third variant even if unchanged }, ], }, eventName: "tolstoy_product_update", });
// Original product from Shopify has 3 variants const originalVariants = [ { id: "var_1", title: "Small", price: 19.99 }, { id: "var_2", title: "Medium", price: 19.99 }, { id: "var_3", title: "Large", price: 19.99 }, ]; // To update product title and medium variant's price window.tolstoyWidget.postMessage({ product: { id: "prod_123", title: "Updated Product Name", variants: [ { id: "var_1" }, // Keep first variant { id: "var_2", price: 24.99, title: "Medium Updated" }, // Update second variant { id: "var_3" }, // Keep third variant ], }, eventName: "tolstoy_product_update", });