[{"data":1,"prerenderedAt":1799},["ShallowReactive",2],{"knowledge-routes":3,"en:footer-pages":643,"en:\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fadd-to-cart-race":656,"en:\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fadd-to-cart-race:navigation":1769,"en:related:\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fsection-rendering-morph,\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fcomponent-base":1773,"en:graph:\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fadd-to-cart-race":1778},{"en":4,"zh":32},[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],"\u002Fshopify\u002Fshopify-app-boundaries","\u002Fshopify\u002Fshopify-app-distribution","\u002Fshopify\u002Fshopify-app-environment-strategy","\u002Fshopify\u002Fshopify-app-review-access","\u002Fshopify\u002Fshopify-app-usage-billing","\u002Fshopify\u002Fshopify-multiple-apps-shared-backend","\u002Fshopify\u002Fshopify-oauth-redirect-callback","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fadd-to-cart-race","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fcomponent-base","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fkeyed-hydration","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Flayout-thrashing","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fliquid-smart-contrast","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fsection-rendering-morph","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fview-transitions","\u002Fshopify\u002Ftopics\u002Fapps-integrations","\u002Fdomains\u002Facquisition-marketing","\u002Fdomains\u002Fcustomer-service","\u002Fdomains\u002Fdata-analytics","\u002Fdomains\u002Ffinance-compliance","\u002Fdomains\u002Ffulfillment-logistics","\u002Fdomains\u002Fpayments","\u002Fdomains\u002Fplatform-development","\u002Fdomains\u002Fproduct-pricing","\u002Fdomains\u002Fretention","\u002Fdomains\u002Fstorefront-experience","\u002Fjourney\u002Fconvert","\u002Ffunnel\u002Fintent",[33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,5,6,7,8,9,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,10,328,329,11,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,12,387,388,389,390,391,13,392,393,394,14,395,15,16,396,397,398,399,400,401,402,17,403,404,405,18,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,19,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,20,21,22,23,24,25,26,27,28,29,632,633,30,634,635,636,637,638,639,640,31,641,642],"\u002Fcommerce\u002Faccessibility-compliance-baseline","\u002Fcommerce\u002Fad-creative-testing","\u002Fcommerce\u002Fapi-authentication","\u002Fcommerce\u002Fapp-distribution-models","\u002Fcommerce\u002Fassortment-planning","\u002Fcommerce\u002Fattribution-basics","\u002Fcommerce\u002Faudiences-remarketing","\u002Fcommerce\u002Fcampaign-formats","\u002Fcommerce\u002Fcheckout-design","\u002Fcommerce\u002Fcheckout-funnel","\u002Fcommerce\u002Fclearance-sales","\u002Fcommerce\u002Fcohort-analysis","\u002Fcommerce\u002Fconsent-and-advertising","\u002Fcommerce\u002Fconsumer-protection-basics","\u002Fcommerce\u002Fcontent-acquisition","\u002Fcommerce\u002Fcontent-localization","\u002Fcommerce\u002Fcontent-repurposing","\u002Fcommerce\u002Fcross-border-basics","\u002Fcommerce\u002Fcustom-data-modeling","\u002Fcommerce\u002Fcustomer-account-access","\u002Fcommerce\u002Fcustomer-data-platform","\u002Fcommerce\u002Fcustomer-demand-validation","\u002Fcommerce\u002Fcustomer-feedback-analysis","\u002Fcommerce\u002Fcustomer-journey-models","\u002Fcommerce\u002Fcustomer-lifecycle-segmentation","\u002Fcommerce\u002Fcustomer-support-channels","\u002Fcommerce\u002Fdata-collection","\u002Fcommerce\u002Fdata-quality","\u002Fcommerce\u002Fdelivery-promise","\u002Fcommerce\u002Fdomain-dns-tls","\u002Fcommerce\u002Fdtc-customer-journey","\u002Fcommerce\u002Femail-sms-marketing","\u002Fcommerce\u002Fenvironments-permissions","\u002Fcommerce\u002Fevent-tracking-plan","\u002Fcommerce\u002Fexperimentation","\u002Fcommerce\u002Fflash-sales","\u002Fcommerce\u002Ffulfillment-delivery","\u002Fcommerce\u002Fgift-with-purchase-bundles","\u002Fcommerce\u002Fgiveaways-contests","\u002Fcommerce\u002Fheadless-commerce","\u002Fcommerce\u002Fidentity-resolution","\u002Fcommerce\u002Finfluencer-collaborations","\u002Fcommerce\u002Finventory-accuracy","\u002Fcommerce\u002Finventory-basics","\u002Fcommerce\u002Finventory-replenishment","\u002Fcommerce\u002Fjourney-stage-alignment","\u002Fcommerce\u002Floyalty-programs","\u002Fcommerce\u002Fmarketing-budget-pacing","\u002Fcommerce\u002Fmarketing-campaign-review","\u002Fcommerce\u002Fmarketing-contact-frequency","\u002Fcommerce\u002Fmarketing-funnel","\u002Fcommerce\u002Fmedia-asset-management","\u002Fcommerce\u002Fmetric-definitions","\u002Fcommerce\u002Forder-event-ad-spend-grain","\u002Fcommerce\u002Forder-unit-economics","\u002Fcommerce\u002Fpaid-acquisition-signals","\u002Fcommerce\u002Fpartial-page-updates","\u002Fcommerce\u002Fpayment-methods","\u002Fcommerce\u002Fpayments-chargebacks","\u002Fcommerce\u002Fpeak-season-campaigns","\u002Fcommerce\u002Fplatform-extension-points","\u002Fcommerce\u002Fpost-purchase-education","\u002Fcommerce\u002Fpre-orders","\u002Fcommerce\u002Fpricing-discounts","\u002Fcommerce\u002Fprivacy-consent-basics","\u002Fcommerce\u002Fproduct-information","\u002Fcommerce\u002Fproduct-launches-drops","\u002Fcommerce\u002Fproduct-search-visibility","\u002Fcommerce\u002Freferral-programs","\u002Fcommerce\u002Frepeat-purchase-retention","\u002Fcommerce\u002Freturns-refunds","\u002Fcommerce\u002Freverse-logistics","\u002Fcommerce\u002Freview-collection","\u002Fcommerce\u002Fsales-channel-publishing","\u002Fcommerce\u002Fsales-tax-vat-basics","\u002Fcommerce\u002Fshipping-rates-strategy","\u002Fcommerce\u002Fstaff-access-control","\u002Fcommerce\u002Fstorefront-component-lifecycle","\u002Fcommerce\u002Fstorefront-design-tokens","\u002Fcommerce\u002Fstorefront-release-validation","\u002Fcommerce\u002Fstorefront-rendering-performance","\u002Fcommerce\u002Fsubscription-commerce","\u002Fcommerce\u002Fthreshold-promotions","\u002Fcommerce\u002Ftransactional-notifications","\u002Fcommerce\u002Furl-redirects","\u002Fcommerce\u002Fusage-based-billing","\u002Fcommerce\u002Fwebhooks","\u002Fcommerce\u002Fwin-back","\u002Fcontent-types\u002Fbrand-story","\u002Fcontent-types\u002Fbrand-values","\u002Fcontent-types\u002Fcore-message","\u002Fcontent-types\u002Fcustomer-reviews","\u002Fcontent-types\u002Fcustomer-testimonials","\u002Fcontent-types\u002Femail-signup","\u002Fcontent-types\u002Ffaq","\u002Fcontent-types\u002Ffeatured-products","\u002Fcontent-types\u002Fguarantee","\u002Fcontent-types\u002Floyalty-rewards","\u002Fcontent-types\u002Fmedia-coverage","\u002Fcontent-types\u002Fpackage-contents","\u002Fcontent-types\u002Fpayment-options","\u002Fcontent-types\u002Fproduct-categories","\u002Fcontent-types\u002Fproduct-overview","\u002Fcontent-types\u002Fproduct-showcase","\u002Fcontent-types\u002Fproduct-specifications","\u002Fcontent-types\u002Fproduct-video","\u002Fcontent-types\u002Fpromotions","\u002Fcontent-types\u002Fproof-metrics","\u002Fcontent-types\u002Frelated-products","\u002Fcontent-types\u002Fresources","\u002Fcontent-types\u002Fshipping-delivery-info","\u002Fcontent-types\u002Fsocial-follow","\u002Fcontent-types\u002Fsupport-contact","\u002Fcontent-types\u002Fthird-party-reviews","\u002Fcontent-types\u002Ftrust-marks","\u002Fcontent-types\u002Ftypes","\u002Fcontent-types\u002Fuser-generated-content","\u002Felevar\u002Fshopify-delivery-chain","\u002Fgoogle-ads\u002Fdynamic-remarketing-feed","\u002Fgoogle-ads\u002Fenhanced-conversions-boundaries","\u002Fgoogle-ads\u002Ftransaction-id-and-reconciliation","\u002Fgoogle-analytics\u002Fcustom-dimensions-and-reconciliation","\u002Fgoogle-analytics\u002Fecommerce-event-mapping","\u002Fgoogle-analytics\u002Fmeasurement-protocol","\u002Fgoogle-analytics\u002Fpage-view-and-spa","\u002Fgoogle-analytics\u002Fproperty-stream-debugging","\u002Fgoogle-merchant-center\u002Fgoogle-ads-linking","\u002Fgoogle-merchant-center\u002Fproduct-feed-review","\u002Fgoogle-tag-manager\u002Fconsent-trigger-troubleshooting","\u002Fgoogle-tag-manager\u002Fcontainers-and-publishing","\u002Fgoogle-tag-manager\u002Fdata-layer-events","\u002Fgoogle-tag-manager\u002Ftag-stack","\u002Fgorgias\u002Fmacros-automation","\u002Fgorgias\u002Ftickets-orders","\u002Fjudge-me\u002Freview-request-scheduling","\u002Fjudge-me\u002Freview-widget-verification","\u002Fklaviyo\u002Fdelivery-unsubscribe-troubleshooting","\u002Fklaviyo\u002Fflow-triggers-and-filters","\u002Fklaviyo\u002Fsubscription-consent-sources","\u002Fmeta-ads\u002Fcustomer-audience-sync","\u002Fmeta-ads\u002Fpixel-capi-event-mapping","\u002Fmeta-ads\u002Fpurchase-event-duplicates","\u002Fmodules\u002Favailability-notification","\u002Fmodules\u002Fbuy-box","\u002Fmodules\u002Fcart-summary","\u002Fmodules\u002Fcollection-browse-filter","\u002Fmodules\u002Fcookie-consent","\u002Fmodules\u002Fcross-sell-upsell","\u002Fmodules\u002Ffit-guidance","\u002Fmodules\u002Fpage-composition","\u002Fmodules\u002Fpatterns","\u002Fmodules\u002Fproduct-selection","\u002Fmodules\u002Fproduct-support-navigation","\u002Fmodules\u002Fpromotion-redemption","\u002Fmodules\u002Freview-display","\u002Fmodules\u002Fsignup-capture","\u002Fmodules\u002Fsite-search","\u002Fmodules\u002Fsocial-proof-strip","\u002Fmodules\u002Fsubscription-terms-summary","\u002Fmodules\u002Fvariant-media-gallery","\u002Fpaypal\u002Fcheckout-disputes","\u002Fpaypal\u002Frefund-not-received","\u002Fpaypal\u002Fsettlement-reconciliation","\u002Fpresentation\u002Faccordion","\u002Fpresentation\u002Fbadge","\u002Fpresentation\u002Fbanner","\u002Fpresentation\u002Fbefore-after","\u002Fpresentation\u002Fcallout","\u002Fpresentation\u002Fcards","\u002Fpresentation\u002Fcarousel","\u002Fpresentation\u002Fcomparison","\u002Fpresentation\u002Fcountdown-timer","\u002Fpresentation\u002Fdrawer","\u002Fpresentation\u002Fempty-state","\u002Fpresentation\u002Fgrid","\u002Fpresentation\u002Fhero","\u002Fpresentation\u002Fhotspot","\u002Fpresentation\u002Finline-form","\u002Fpresentation\u002Flist","\u002Fpresentation\u002Fmarquee","\u002Fpresentation\u002Fmasonry","\u002Fpresentation\u002Fmedia-gallery","\u002Fpresentation\u002Fmodal","\u002Fpresentation\u002Fnavigation-menu","\u002Fpresentation\u002Foverlay","\u002Fpresentation\u002Fpagination","\u002Fpresentation\u002Fpatterns","\u002Fpresentation\u002Fpopover","\u002Fpresentation\u002Fprogress-bar","\u002Fpresentation\u002Frating-stars","\u002Fpresentation\u002Fscroll-reveal","\u002Fpresentation\u002Fsingle-column","\u002Fpresentation\u002Fskeleton-loader","\u002Fpresentation\u002Fsplit","\u002Fpresentation\u002Fstepper","\u002Fpresentation\u002Fsticky-bar","\u002Fpresentation\u002Fswatch","\u002Fpresentation\u002Ftable","\u002Fpresentation\u002Ftabs","\u002Fpresentation\u002Ftimeline","\u002Fpresentation\u002Ftoast","\u002Fregulations\u002Fca-casl","\u002Fregulations\u002Fca-pipeda-consent","\u002Fregulations\u002Feu-accessibility-act","\u002Fregulations\u002Feu-consumer-rights","\u002Fregulations\u002Feu-gdpr-eprivacy-consent","\u002Fregulations\u002Feu-price-reduction-indication","\u002Fregulations\u002Feu-psd2-sca","\u002Fregulations\u002Feu-ucpd-reviews-ranking","\u002Fregulations\u002Feu-vat-oss-ioss","\u002Fregulations\u002Fuk-consumer-contracts","\u002Fregulations\u002Fuk-consumer-rights","\u002Fregulations\u002Fuk-dmcc-reviews-pricing","\u002Fregulations\u002Fuk-gdpr-pecr-consent","\u002Fregulations\u002Fuk-vat-overseas-sellers","\u002Fregulations\u002Fus-can-spam","\u002Fregulations\u002Fus-consumer-reviews-testimonials","\u002Fregulations\u002Fus-endorsement-guides","\u002Fregulations\u002Fus-mail-order-rule","\u002Fregulations\u002Fus-tcpa-text-consent","\u002Fshopify\u002Farticle","\u002Fshopify\u002Farticle\u002Fbuying-guide-article","\u002Fshopify\u002Farticle\u002Fhow-to-article","\u002Fshopify\u002Fblog","\u002Fshopify\u002Fcart","\u002Fshopify\u002Fcollection","\u002Fshopify\u002Fcollection\u002Fcampaign-collection-page","\u002Fshopify\u002Fcollection\u002Fcategory-collection-page","\u002Fshopify\u002Fdawn-vs-horizon","\u002Fshopify\u002Fdiscount-troubleshooting","\u002Fshopify\u002Femail-platform-comparison","\u002Fshopify\u002Fhomepage","\u002Fshopify\u002Finventory-mismatch","\u002Fshopify\u002Flist-collections","\u002Fshopify\u002Forder-analytics-reconciliation","\u002Fshopify\u002Fpage","\u002Fshopify\u002Fpage\u002Fabout-us","\u002Fshopify\u002Fpage\u002Fbrand-story","\u002Fshopify\u002Fpage\u002Fcampaign-landing","\u002Fshopify\u002Fpage\u002Fcontact-us","\u002Fshopify\u002Fpage\u002Ffaq","\u002Fshopify\u002Fpage\u002Fgiveaway","\u002Fshopify\u002Fpage\u002Floyalty-program","\u002Fshopify\u002Fpage\u002Forder-tracking","\u002Fshopify\u002Fpage\u002Fpolicies","\u002Fshopify\u002Fpage\u002Fpress","\u002Fshopify\u002Fpage\u002Freviews","\u002Fshopify\u002Fpage\u002Fshipping-returns","\u002Fshopify\u002Fpage\u002Fsize-guide","\u002Fshopify\u002Fpage\u002Fstore-locator","\u002Fshopify\u002Fpayment-gateway-comparison","\u002Fshopify\u002Fpreorder-delay-troubleshooting","\u002Fshopify\u002Fproduct","\u002Fshopify\u002Fproduct\u002Ffit-sensitive-product-page","\u002Fshopify\u002Fproduct\u002Fpreorder-subscription-page","\u002Fshopify\u002Fproduct\u002Fproduct-drop-page","\u002Fshopify\u002Fproduct\u002Fstandard-product-page","\u002Fshopify\u002Freview-options-comparison","\u002Fshopify\u002Fsearch","\u002Fshopify\u002Fshipping-rate-troubleshooting","\u002Fshopify\u002Fshopify-admin-api-graphql","\u002Fshopify\u002Fshopify-admin-map","\u002Fshopify\u002Fshopify-amount-check","\u002Fshopify\u002Fshopify-analytics-reports","\u002Fshopify\u002Fshopify-b2b","\u002Fshopify\u002Fshopify-bundles","\u002Fshopify\u002Fshopify-checkout-customization","\u002Fshopify\u002Fshopify-collections-publishing","\u002Fshopify\u002Fshopify-custom-data","\u002Fshopify\u002Fshopify-customer-accounts","\u002Fshopify\u002Fshopify-customer-privacy","\u002Fshopify\u002Fshopify-customer-segments","\u002Fshopify\u002Fshopify-discounts","\u002Fshopify\u002Fshopify-domains-dns","\u002Fshopify\u002Fshopify-ecosystem","\u002Fshopify\u002Fshopify-ecosystem-analysis","\u002Fshopify\u002Fshopify-entry-map","\u002Fshopify\u002Fshopify-file-sync-diff","\u002Fshopify\u002Fshopify-files-media","\u002Fshopify\u002Fshopify-flow","\u002Fshopify\u002Fshopify-follow-on-shop","\u002Fshopify\u002Fshopify-fraud-disputes","\u002Fshopify\u002Fshopify-fulfillment-delivery","\u002Fshopify\u002Fshopify-functions-extensions","\u002Fshopify\u002Fshopify-gift-cards","\u002Fshopify\u002Fshopify-headless","\u002Fshopify\u002Fshopify-identities-permissions","\u002Fshopify\u002Fshopify-inventory-locations","\u002Fshopify\u002Fshopify-knowledge-base-method","\u002Fshopify\u002Fshopify-knowledge-source-inventory","\u002Fshopify\u002Fshopify-local-delivery-pickup","\u002Fshopify\u002Fshopify-marketing-channels","\u002Fshopify\u002Fshopify-marketing-messaging","\u002Fshopify\u002Fshopify-markets-shipping","\u002Fshopify\u002Fshopify-multi-currency-pricing","\u002Fshopify\u002Fshopify-navigation-menus","\u002Fshopify\u002Fshopify-notifications-emails","\u002Fshopify\u002Fshopify-online-store-preferences","\u002Fshopify\u002Fshopify-order-payment-status","\u002Fshopify\u002Fshopify-orders-management","\u002Fshopify\u002Fshopify-payments-checkout","\u002Fshopify\u002Fshopify-plans","\u002Fshopify\u002Fshopify-pos","\u002Fshopify\u002Fshopify-product-import-export","\u002Fshopify\u002Fshopify-products-variants","\u002Fshopify\u002Fshopify-purchase-journey","\u002Fshopify\u002Fshopify-purchase-validation","\u002Fshopify\u002Fshopify-returns-refunds","\u002Fshopify\u002Fshopify-sales-channels","\u002Fshopify\u002Fshopify-search-and-discovery","\u002Fshopify\u002Fshopify-selling-plans","\u002Fshopify\u002Fshopify-shipping-rates-labels","\u002Fshopify\u002Fshopify-storefront","\u002Fshopify\u002Fshopify-storefront-performance","\u002Fshopify\u002Fshopify-storefront-seo-framework","\u002Fshopify\u002Fshopify-tagging-options","\u002Fshopify\u002Fshopify-taxes-duties","\u002Fshopify\u002Fshopify-theme-management","\u002Fshopify\u002Fshopify-translation-localization","\u002Fshopify\u002Fshopify-url-redirects","\u002Fshopify\u002Fshopify-verification-priorities","\u002Fshopify\u002Fshopify-web-pixels","\u002Fshopify\u002Fshopify-webhooks-events","\u002Fshopify\u002Fsubscription-app-comparison","\u002Fshopify\u002Ftheme\u002Farchitecture","\u002Fshopify\u002Ftheme\u002Fcapability-modules","\u002Fshopify\u002Ftheme\u002Fcontent-architecture","\u002Fshopify\u002Ftheme\u002Fdecision-patterns-and-states","\u002Fshopify\u002Ftheme\u002Fdelivery-framework","\u002Fshopify\u002Ftheme\u002Fglobal-regions","\u002Fshopify\u002Ftheme\u002Flayout","\u002Fshopify\u002Ftheme\u002Flocales","\u002Fshopify\u002Ftheme\u002Fsettings","\u002Fshopify\u002Ftheme\u002Ftemplates","\u002Fshopify\u002Fthemes\u002Fdawn\u002Faccessibility-patterns","\u002Fshopify\u002Fthemes\u002Fdawn\u002Farchitecture","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fbuy-form-and-availability","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fcart-drawer-notification","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fcolor-schemes","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fcontent-sections-and-animations","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fcountdown-timer","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fcustom-elements-pubsub","\u002Fshopify\u002Fthemes\u002Fdawn\u002Ffacets-and-pagination","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fheader-navigation","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fhtml-update-utility","\u002Fshopify\u002Fthemes\u002Fdawn\u002Floading-performance","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fnewsletter-and-badges","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fpredictive-search","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fproduct-media","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fquantity-input","\u002Fshopify\u002Fthemes\u002Fdawn\u002Frecommendations","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fsection-rendering","\u002Fshopify\u002Fthemes\u002Fdawn\u002Ftheme-editor-events","\u002Fshopify\u002Fthemes\u002Fdawn\u002Fvariant-update-protocol","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Farchitecture","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fbadges-reviews-signup","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fbuying","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fcart","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fcollection-search","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fcontent-modules","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Ffacets-and-pagination","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fheader-navigation","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Flayout","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fmarquee-slideshow-animations","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fmedia-zoom-and-hotspots","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fpredictive-search","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fproduct-cards","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fproduct-page","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Freading-source","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Frecommendations","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fsticky-add-to-cart-and-availability","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fstyles","\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fvariants","\u002Fshopify\u002Fthemes\u002Fimpact\u002Fbehavior-components","\u002Fshopify\u002Fthemes\u002Fimpact\u002Fcart-events","\u002Fshopify\u002Fthemes\u002Fimpact\u002Fdialog-element","\u002Fshopify\u002Fthemes\u002Fimpact","\u002Fshopify\u002Fthemes\u002Fimpact\u002Flazy-media-player","\u002Fshopify\u002Fthemes\u002Fimpact\u002Fsection-spacing-collapsing","\u002Fshopify\u002Fthemes\u002Fimpact\u002Fvariant-picker-rerender","\u002Fshopify\u002Fthemes","\u002Fshopify\u002Fthemes\u002Fpattern-coverage","\u002Fshopify\u002Fwebhook-delivery-troubleshooting","\u002Ftasks\u002Fadd-product-custom-fields","\u002Ftasks\u002Fanalyse-a-repeat-purchase-cohort","\u002Ftasks\u002Fanalyze-customer-feedback","\u002Ftasks\u002Fanswer-order-status-inquiries","\u002Ftasks\u002Faudit-marketing-contact-pressure","\u002Ftasks\u002Fbuild-a-content-calendar","\u002Ftasks\u002Fcalculate-order-contribution","\u002Ftasks\u002Fcalculate-promotion-margin","\u002Ftasks\u002Fclean-up-a-marketing-list","\u002Ftasks\u002Fcollect-and-display-customer-reviews","\u002Ftasks\u002Fconfigure-sales-tax-or-vat","\u002Ftasks\u002Fconfigure-site-search-and-filters","\u002Ftasks\u002Fdefine-repeat-purchase-metrics","\u002Ftasks\u002Fdesign-loyalty-points-rules","\u002Ftasks\u002Fdiagnose-storefront-performance","\u002Ftasks\u002Fenable-and-test-a-payment-method","\u002Ftasks\u002Fevaluate-and-install-an-app","\u002Ftasks\u002Fhandle-a-delayed-order","\u002Ftasks\u002Fhandle-subscription-pause-and-cancellation","\u002Ftasks\u002Fintegrate-and-verify-a-webhook","\u002Ftasks\u002Flaunch-a-referral-program","\u002Ftasks\u002Fplan-a-discount-campaign","\u002Ftasks\u002Fplan-a-peak-season-campaign","\u002Ftasks\u002Fplan-a-product-assortment","\u002Ftasks\u002Fplan-a-win-back-campaign","\u002Ftasks\u002Fplan-an-ad-creative-test","\u002Ftasks\u002Fplan-inventory-replenishment","\u002Ftasks\u002Fplan-post-purchase-education","\u002Ftasks\u002Fprocess-a-refund","\u002Ftasks\u002Fprocess-returned-goods","\u002Ftasks\u002Fpublish-privacy-notice","\u002Ftasks\u002Freconcile-orders-and-analytics","\u002Ftasks\u002Frespond-to-a-chargeback","\u002Ftasks\u002Frespond-to-a-negative-review","\u002Ftasks\u002Freview-a-marketing-campaign","\u002Ftasks\u002Freview-creator-deliverables","\u002Ftasks\u002Freview-marketing-budget-pacing","\u002Ftasks\u002Freview-product-page-module-order","\u002Ftasks\u002Frun-a-cycle-count","\u002Ftasks\u002Frun-a-giveaway","\u002Ftasks\u002Frun-a-post-purchase-survey","\u002Ftasks\u002Frun-an-accessibility-baseline","\u002Ftasks\u002Fsend-back-in-stock-notifications","\u002Ftasks\u002Fseparate-development-environments","\u002Ftasks\u002Fset-shipping-rates","\u002Ftasks\u002Fset-up-a-pre-order","\u002Ftasks\u002Fset-up-a-welcome-flow","\u002Ftasks\u002Fset-up-conversion-tracking","\u002Ftasks\u002Fset-up-cookie-consent","\u002Ftasks\u002Fset-up-presales-support","\u002Ftasks\u002Ftag-campaign-links","\u002Ftasks\u002Ftest-a-purchase","\u002Ftasks\u002Fvalidate-a-customer-need","\u002Ftasks\u002Fvalidate-audience-sync","\u002Ftasks\u002Fwrite-a-creator-brief","\u002Ftasks\u002Fwrite-a-return-policy","\u002Ftasks\u002Fwrite-an-event-tracking-plan","\u002Ftasks\u002Fwrite-product-use-and-care-guide","\u002Fterms\u002Fabove-the-fold","\u002Fterms\u002Faccess-scope","\u002Fterms\u002Faccessible-rich-internet-applications","\u002Fterms\u002Famericans-with-disabilities-act","\u002Fterms\u002Fapi-versioning","\u002Fterms\u002Fattribution-model","\u002Fterms\u002Fattribution-window","\u002Fterms\u002Faverage-order-value","\u002Fterms\u002Faverage-resolution-time","\u002Fterms\u002Fbackorder","\u002Fterms\u002Fblack-friday-cyber-monday","\u002Fterms\u002Fbreak-even-point","\u002Fterms\u002Fbusiness-to-business","\u002Fterms\u002Fbusiness-to-consumer","\u002Fterms\u002Fbuy-now-pay-later","\u002Fterms\u002Fcall-to-action","\u002Fterms\u002Fcart-abandonment-rate","\u002Fterms\u002Fcash-flow","\u002Fterms\u002Fcash-on-delivery","\u002Fterms\u002Fchargeback","\u002Fterms\u002Fclick-through-rate","\u002Fterms\u002Fcohort","\u002Fterms\u002Fcontent-delivery-network","\u002Fterms\u002Fcontent-security-policy","\u002Fterms\u002Fcontribution-margin","\u002Fterms\u002Fconversion-rate","\u002Fterms\u002Fconversion-rate-optimization","\u002Fterms\u002Fcost-of-goods-sold","\u002Fterms\u002Fcost-per-action","\u002Fterms\u002Fcost-per-click","\u002Fterms\u002Fcost-per-mille","\u002Fterms\u002Fcross-selling","\u002Fterms\u002Fcumulative-layout-shift","\u002Fterms\u002Fcustomer-acquisition-cost","\u002Fterms\u002Fcustomer-churn-rate","\u002Fterms\u002Fcustomer-effort-score","\u002Fterms\u002Fcustomer-lifetime-value","\u002Fterms\u002Fcustomer-relationship-management","\u002Fterms\u002Fcustomer-retention-rate","\u002Fterms\u002Fcustomer-satisfaction-score","\u002Fterms\u002Fdays-of-supply","\u002Fterms\u002Fdelivered-at-place","\u002Fterms\u002Fdelivered-duty-paid","\u002Fterms\u002Fdirect-to-consumer","\u002Fterms\u002Fdomain-name-system-record","\u002Fterms\u002Femail-delivery-rate","\u002Fterms\u002Feuropean-accessibility-act","\u002Fterms\u002Fevent","\u002Fterms\u002Ffeature-flag","\u002Fterms\u002Ffirst-contact-resolution","\u002Fterms\u002Ffirst-response-time","\u002Fterms\u002Fgeneral-data-protection-regulation","\u002Fterms\u002Fglobal-trade-item-number","\u002Fterms\u002Fgross-margin","\u002Fterms\u002Fgross-merchandise-value","\u002Fterms\u002Fgross-profit","\u002Fterms\u002Fharmonized-system-code","\u002Fterms\u002Fhash-based-message-authentication-code","\u002Fterms\u002Fideal-customer-profile","\u002Fterms\u002Fidempotency-key","\u002Fterms\u002Fimport-one-stop-shop","\u002Fterms\u002Finteraction-to-next-paint","\u002Fterms\u002Finventory-record-accuracy","\u002Fterms\u002Flanded-cost","\u002Fterms\u002Flargest-contentful-paint","\u002Fterms\u002Flead-time","\u002Fterms\u002Fminimum-order-quantity","\u002Fterms\u002Fmonth-to-date","\u002Fterms\u002Fmonthly-recurring-revenue","\u002Fterms\u002Fnet-promoter-score","\u002Fterms\u002Fnet-sales","\u002Fterms\u002Foauth-2-authorization-framework","\u002Fterms\u002Fpayment-authorization","\u002Fterms\u002Fpayment-capture","\u002Fterms\u002Fpayment-settlement","\u002Fterms\u002Fpoint-of-sale","\u002Fterms\u002Fpre-order","\u002Fterms\u002Fproduct-bundle","\u002Fterms\u002Fproduct-detail-page","\u002Fterms\u002Fproduct-market-fit","\u002Fterms\u002Fproduct-variant","\u002Fterms\u002Frate-limiting","\u002Fterms\u002Freactivation-rate","\u002Fterms\u002Frecency-frequency-monetary","\u002Fterms\u002Frefund","\u002Fterms\u002Freorder-point","\u002Fterms\u002Frepeat-purchase-rate","\u002Fterms\u002Fresponsive-web-design","\u002Fterms\u002Freturn-on-ad-spend","\u002Fterms\u002Freturn-rate","\u002Fterms\u002Frevenue-per-session","\u002Fterms\u002Fsafety-stock","\u002Fterms\u002Fsearch-engine-marketing","\u002Fterms\u002Fsearch-engine-optimization","\u002Fterms\u002Fsell-through-rate","\u002Fterms\u002Fservice-level-agreement","\u002Fterms\u002Fsession","\u002Fterms\u002Fstaging-environment","\u002Fterms\u002Fstock-keeping-unit","\u002Fterms\u002Fstrong-customer-authentication","\u002Fterms\u002Fsubscription-churn-rate","\u002Fterms\u002Ftelevision-commercial","\u002Fterms\u002Fthird-party-logistics","\u002Fterms\u002Fthree-domain-secure","\u002Fterms\u002Fticket-backlog","\u002Fterms\u002Ftls-certificate","\u002Fterms\u002Funique-selling-proposition","\u002Fterms\u002Funsubscribe-rate","\u002Fterms\u002Fup-selling","\u002Fterms\u002Furchin-tracking-module","\u002Fterms\u002Fuser","\u002Fterms\u002Fuser-generated-content","\u002Fterms\u002Fvalue-added-tax","\u002Fterms\u002Fweb-content-accessibility-guidelines","\u002Fterms\u002Fwebhook","\u002Fwordpress\u002Ftemplates-and-content","\u002Fwordpress\u002Ftheme-json-and-patterns","\u002Fshopify\u002Ftopics\u002Fcustomers","\u002Fshopify\u002Ftopics\u002Fdata-automation","\u002Fshopify\u002Ftopics\u002Fecosystem","\u002Fshopify\u002Ftopics\u002Fofficial-themes","\u002Fshopify\u002Ftopics\u002Fpage-composition-patterns","\u002Fshopify\u002Ftopics\u002Fproducts-content","\u002Fshopify\u002Ftopics\u002Fstore-management","\u002Fshopify\u002Ftopics\u002Fstorefront","\u002Fshopify\u002Ftopics\u002Fstorefront-content-types","\u002Fshopify\u002Ftopics\u002Fstorefront-modules","\u002Fshopify\u002Ftopics\u002Fstorefront-pages","\u002Fshopify\u002Ftopics\u002Ftransactions","\u002Fcommerce\u002Fpaths\u002Fcampaign-planning","\u002Fcommerce\u002Fpaths\u002Fcampaign-tracking","\u002Fcommerce\u002Fpaths\u002Fcommerce-concepts","\u002Fcommerce\u002Fpaths\u002Fcommerce-terms-foundation","\u002Fcommerce\u002Fpaths\u002Fcompliance-baseline","\u002Fcommerce\u002Fpaths\u002Fconsent-and-tracking","\u002Fcommerce\u002Fpaths\u002Fcustomer-demand-validation","\u002Fcommerce\u002Fpaths\u002Fecommerce-tracking-implementation","\u002Fcommerce\u002Fpaths\u002Fmarketing-measurement","\u002Fcommerce\u002Fpaths\u002Forder-unit-economics","\u002Fcommerce\u002Fpaths\u002Fplatform-development-foundations","\u002Fcommerce\u002Fpaths\u002Fplatform-integration-foundations","\u002Fcommerce\u002Fpaths\u002Fpost-purchase-operations","\u002Fcommerce\u002Fpaths\u002Fproduct-to-purchase","\u002Fcommerce\u002Fpaths\u002Frepeat-purchase-cohorts","\u002Fcommerce\u002Fpaths\u002Fretention-operations","\u002Fcommerce\u002Fpaths\u002Fshipping-and-service","\u002Fcommerce\u002Fpaths\u002Ftrustworthy-commerce-data","\u002Fshopify\u002Fpaths\u002Fbuild-your-store","\u002Fshopify\u002Fpaths\u002Fcontent-foundations","\u002Fshopify\u002Fpaths\u002Fdawn","\u002Fshopify\u002Fpaths\u002Fofficial-themes","\u002Fshopify\u002Fpaths\u002Fpage-recipes","\u002Fshopify\u002Fpaths\u002Fplatform-basics","\u002Fshopify\u002Fpaths\u002Fpresentation-accessibility","\u002Fshopify\u002Fpaths\u002Fstorefront-platform-mechanisms","\u002Fshopify\u002Fpaths\u002Ftheme-foundations","\u002Fshopify\u002Fpaths\u002Ftheme-pattern-audit","\u002Fshopify\u002Fpaths\u002Fvalidate-purchase-tracking","\u002Fjourney\u002Fdiscover","\u002Fjourney\u002Fevaluate","\u002Fjourney\u002Frepurchase","\u002Fjourney\u002Fuse","\u002Fjourney\u002Fengage","\u002Fjourney\u002Fdeliver","\u002Ffunnel\u002Fawareness","\u002Ffunnel\u002Finterest","\u002Ffunnel\u002Fconsideration","\u002Ffunnel\u002Fpurchase","\u002Ffunnel\u002Fengage",[644,648,652],{"id":645,"path":646,"title":647},"en_sitePages\u002Fabout.md","\u002Fabout","About WooDawn",{"id":649,"path":650,"title":651},"en_sitePages\u002Flegal\u002Fprivacy.md","\u002Flegal\u002Fprivacy","Privacy Notice",{"id":653,"path":654,"title":655},"en_sitePages\u002Flegal\u002Fterms.md","\u002Flegal\u002Fterms","Content Use Terms",{"document":657,"isArticle":1735},{"id":658,"title":659,"abbreviations":660,"aliases":661,"answers":662,"appliesTo":663,"articleType":664,"body":665,"businessModel":1724,"constrainedBy":1725,"currency":1726,"description":1727,"discussionUrl":663,"domains":1728,"evidenceStatus":1730,"extension":1731,"funnel":1732,"implements":1734,"indexable":1735,"measuredBy":1736,"meta":1737,"metric":663,"navigation":1735,"needs":1738,"originalSources":1739,"path":12,"regions":1740,"related":1741,"reviewAfter":663,"roles":1742,"seo":1744,"seoImage":663,"seoTitle":663,"sources":1745,"stages":1747,"status":1749,"stem":1750,"supersededBy":663,"tags":1751,"term":663,"themeSources":1758,"tools":1762,"updatedAt":1764,"uses":1765,"verification":1766,"verifiedAt":1767,"__hash__":1768},"en_articles\u002Fshopify\u002Fthemes\u002Fhorizon\u002Fadd-to-cart-race.md","Horizon's Add-to-Cart Race Handling: Clicking Add While a Variant Switch Is Still Pending",[],[],[],null,"guide",{"type":666,"value":667,"toc":1709},"minimark",[668,683,688,707,721,725,735,858,862,867,886,957,975,979,986,1112,1115,1119,1126,1180,1191,1195,1313,1328,1331,1376,1456,1462,1466,1487,1587,1591,1617,1621,1628,1632,1673,1677,1684,1687,1702,1705],[669,670,671,672,682],"p",{},"This article is based on Horizon 4.2.0, with source pinned to ",[673,674,678],"a",{"href":675,"rel":676},"https:\u002F\u002Fgithub.com\u002FShopify\u002Fhorizon\u002Ftree\u002F5acd1b6b66c02f61d3216e3adace5dd9e0404fc9",[677],"nofollow",[679,680,681],"code",{},"5acd1b6"," (verified 2026-10-07). Conclusions are limited to that commit; this is a static source analysis and nothing was tested in a store.",[684,685,687],"h2",{"id":686},"the-problem","The problem",[669,689,690,691,694,695,699,700,703,704,706],{},"When a shopper switches variants, the variant picker first requests new section HTML, and only after it returns does it update the hidden ",[679,692,693],{},"input[name=\"id\"]",", price, inventory and button state. If the shopper picks M and ",[696,697,698],"strong",{},"immediately"," clicks \"Add to cart\" while the request is still in flight, a plain form submit still carries the ",[696,701,702],{},"previous variant"," in ",[679,705,693],{},": they think they added M, but the cart holds S. If the previous variant is sold out or at its purchase limit, the add fails outright.",[669,708,709,714,715,720],{},[673,710,713],{"href":711,"rel":712},"https:\u002F\u002Fgithub.com\u002FShopify\u002Fhorizon\u002Fblob\u002F5acd1b6b66c02f61d3216e3adace5dd9e0404fc9\u002Fassets\u002Fproduct-form.js",[677],"assets\u002Fproduct-form.js"," handles this window explicitly, with the decision logic extracted into a pure function in ",[673,716,719],{"href":717,"rel":718},"https:\u002F\u002Fgithub.com\u002FShopify\u002Fhorizon\u002Fblob\u002F5acd1b6b66c02f61d3216e3adace5dd9e0404fc9\u002Fassets\u002Fvariant-resolution.js",[677],"assets\u002Fvariant-resolution.js",".",[684,722,724],{"id":723},"overall-flow","Overall flow",[726,727,732],"pre",{"className":728,"code":730,"language":731},[729],"language-text","User selects a variant\n  └─ variant-picker dispatches ProductSelectEvent (carrying the section request's promise)\n       └─ product-form: generation++, variantChangeInProgress = true, remember pendingVariantChange\n\nUser clicks add to cart (handleSubmit)\n  ├─ No variant request in flight → submit normally\n  └─ Variant request in flight → push a \"snapshot\" onto the queue; the button still plays its add animation\n\nVariant request settles (success or failure)\n  └─ If still the latest generation → clear the in-progress flag → drain the queue\n       └─ Resolve each snapshot's variant → normalize quantity → one batched POST\n","text",[679,733,730],{"__ignoreMap":734},"",[726,736,740],{"className":737,"code":738,"language":739,"meta":734,"style":734},"language-mermaid shiki shiki-themes github-light","sequenceDiagram\n  accTitle: Horizon 4.2.0 sequence when add to cart is clicked while a variant request is in flight\n  accDescr: variant-picker dispatches a ProductSelectEvent carrying a promise before the request, and product-form enters the in-flight state; a click on add only enqueues a snapshot and plays the animation, and the queue is drained into one batched POST once the latest generation settles.\n  actor U as User\n  participant VP as variant-picker\n  participant PF as product-form\n  participant S as Shopify\n  U->>VP: Selects a variant\n  VP->>PF: Dispatches ProductSelectEvent (carrying the section request's promise)\n  PF->>PF: generation++, variantChangeInProgress = true, remember pendingVariantChange\n  VP->>S: fetch(requestUrl) for the new section HTML\n  U->>PF: Clicks add to cart (handleSubmit)\n  PF->>PF: Variant request in flight, push a snapshot onto the queue\n  PF-->>U: animateAddToCart() still plays the add animation\n  S-->>VP: Returns section HTML\n  VP-->>PF: event.promise settles\n  PF->>PF: Still the latest generation, clear the in-progress flag, drain the queue\n  PF->>PF: Resolve each snapshot's variant, normalize quantity\n  PF->>S: One batched POST to cart_add_url (items array)\n","mermaid",[679,741,742,750,756,762,768,774,780,786,792,798,804,810,816,822,828,834,840,846,852],{"__ignoreMap":734},[743,744,747],"span",{"class":745,"line":746},"line",1,[743,748,749],{},"sequenceDiagram\n",[743,751,753],{"class":745,"line":752},2,[743,754,755],{},"  accTitle: Horizon 4.2.0 sequence when add to cart is clicked while a variant request is in flight\n",[743,757,759],{"class":745,"line":758},3,[743,760,761],{},"  accDescr: variant-picker dispatches a ProductSelectEvent carrying a promise before the request, and product-form enters the in-flight state; a click on add only enqueues a snapshot and plays the animation, and the queue is drained into one batched POST once the latest generation settles.\n",[743,763,765],{"class":745,"line":764},4,[743,766,767],{},"  actor U as User\n",[743,769,771],{"class":745,"line":770},5,[743,772,773],{},"  participant VP as variant-picker\n",[743,775,777],{"class":745,"line":776},6,[743,778,779],{},"  participant PF as product-form\n",[743,781,783],{"class":745,"line":782},7,[743,784,785],{},"  participant S as Shopify\n",[743,787,789],{"class":745,"line":788},8,[743,790,791],{},"  U->>VP: Selects a variant\n",[743,793,795],{"class":745,"line":794},9,[743,796,797],{},"  VP->>PF: Dispatches ProductSelectEvent (carrying the section request's promise)\n",[743,799,801],{"class":745,"line":800},10,[743,802,803],{},"  PF->>PF: generation++, variantChangeInProgress = true, remember pendingVariantChange\n",[743,805,807],{"class":745,"line":806},11,[743,808,809],{},"  VP->>S: fetch(requestUrl) for the new section HTML\n",[743,811,813],{"class":745,"line":812},12,[743,814,815],{},"  U->>PF: Clicks add to cart (handleSubmit)\n",[743,817,819],{"class":745,"line":818},13,[743,820,821],{},"  PF->>PF: Variant request in flight, push a snapshot onto the queue\n",[743,823,825],{"class":745,"line":824},14,[743,826,827],{},"  PF-->>U: animateAddToCart() still plays the add animation\n",[743,829,831],{"class":745,"line":830},15,[743,832,833],{},"  S-->>VP: Returns section HTML\n",[743,835,837],{"class":745,"line":836},16,[743,838,839],{},"  VP-->>PF: event.promise settles\n",[743,841,843],{"class":745,"line":842},17,[743,844,845],{},"  PF->>PF: Still the latest generation, clear the in-progress flag, drain the queue\n",[743,847,849],{"class":745,"line":848},18,[743,850,851],{},"  PF->>PF: Resolve each snapshot's variant, normalize quantity\n",[743,853,855],{"class":745,"line":854},19,[743,856,857],{},"  PF->>S: One batched POST to cart_add_url (items array)\n",[684,859,861],{"id":860},"key-design-points","Key design points",[863,864,866],"h3",{"id":865},"_1-the-event-carries-a-promise","1. The event carries a promise",[669,868,869,703,872,877,878,881,882,885],{},[679,870,871],{},"fetchUpdatedSection",[673,873,876],{"href":874,"rel":875},"https:\u002F\u002Fgithub.com\u002FShopify\u002Fhorizon\u002Fblob\u002F5acd1b6b66c02f61d3216e3adace5dd9e0404fc9\u002Fassets\u002Fvariant-picker.js",[677],"variant-picker.js"," dispatches ",[679,879,880],{},"ProductSelectEvent"," ",[696,883,884],{},"before starting the request",", with the request result's promise attached to the event:",[726,887,891],{"className":888,"code":889,"language":890,"meta":734,"style":734},"language-js shiki shiki-themes github-light","const deferredEventPromise = ProductSelectEvent.createPromise();\nthis.dispatchEvent(new ProductSelectEvent({ ..., promise: deferredEventPromise.promise }));\nfetch(requestUrl, { signal }) \u002F* resolves on success, rejects on failure or abort *\u002F\n","js",[679,892,893,917,945],{"__ignoreMap":734},[743,894,895,899,903,906,910,914],{"class":745,"line":746},[743,896,898],{"class":897},"sD7c4","const",[743,900,902],{"class":901},"sYu0t"," deferredEventPromise",[743,904,905],{"class":897}," =",[743,907,909],{"class":908},"sgsFI"," ProductSelectEvent.",[743,911,913],{"class":912},"s7eDp","createPromise",[743,915,916],{"class":908},"();\n",[743,918,919,922,924,927,930,933,936,939,942],{"class":745,"line":752},[743,920,921],{"class":901},"this",[743,923,720],{"class":908},[743,925,926],{"class":912},"dispatchEvent",[743,928,929],{"class":908},"(",[743,931,932],{"class":897},"new",[743,934,935],{"class":912}," ProductSelectEvent",[743,937,938],{"class":908},"({ ",[743,940,941],{"class":897},"...",[743,943,944],{"class":908},", promise: deferredEventPromise.promise }));\n",[743,946,947,950,953],{"class":745,"line":758},[743,948,949],{"class":912},"fetch",[743,951,952],{"class":908},"(requestUrl, { signal }) ",[743,954,956],{"class":955},"sAwPA","\u002F* resolves on success, rejects on failure or abort *\u002F\n",[669,958,959,960,963,964,966,967,970,971,974],{},"Listeners don't have to wait for the request to know \"the variant is changing\"; they can enter the in-flight state immediately and ",[679,961,962],{},"await event.promise"," for the result later. ",[679,965,880],{}," is imported from ",[679,968,969],{},"@shopify\u002Fevents",", which the importmap points at ",[679,972,973],{},"cdn.shopify.com\u002Fstorefront\u002Fstandard-events.js",": Shopify's standard events module, not a theme-defined event.",[863,976,978],{"id":977},"_2-a-generation-counter-keeps-old-requests-from-clearing-new-state","2. A generation counter keeps old requests from clearing new state",[669,980,981,982,985],{},"A user might switch S → M → L in a row, and each switch aborts the previous request. When a cancelled request reaches its ",[679,983,984],{},"finally",", it must not clear the in-flight flag, because L's request hasn't returned yet:",[726,987,989],{"className":888,"code":988,"language":890,"meta":734,"style":734},"const generation = ++this.#variantChangeGeneration;\nthis.#variantChangeInProgress = true;\nthis.#pendingVariantChange = event.promise;\ntry { \u002F* await event.promise, update button, price, etc. *\u002F }\nfinally {\n  if (generation === this.#variantChangeGeneration) {\n    this.#variantChangeInProgress = false;\n    await this.#drainAddToCartQueue();\n  }\n}\n",[679,990,991,1008,1024,1036,1050,1057,1074,1088,1102,1107],{"__ignoreMap":734},[743,992,993,995,998,1000,1003,1005],{"class":745,"line":746},[743,994,898],{"class":897},[743,996,997],{"class":901}," generation",[743,999,905],{"class":897},[743,1001,1002],{"class":897}," ++",[743,1004,921],{"class":901},[743,1006,1007],{"class":908},".#variantChangeGeneration;\n",[743,1009,1010,1012,1015,1018,1021],{"class":745,"line":752},[743,1011,921],{"class":901},[743,1013,1014],{"class":908},".#variantChangeInProgress ",[743,1016,1017],{"class":897},"=",[743,1019,1020],{"class":901}," true",[743,1022,1023],{"class":908},";\n",[743,1025,1026,1028,1031,1033],{"class":745,"line":758},[743,1027,921],{"class":901},[743,1029,1030],{"class":908},".#pendingVariantChange ",[743,1032,1017],{"class":897},[743,1034,1035],{"class":908}," event.promise;\n",[743,1037,1038,1041,1044,1047],{"class":745,"line":764},[743,1039,1040],{"class":897},"try",[743,1042,1043],{"class":908}," { ",[743,1045,1046],{"class":955},"\u002F* await event.promise, update button, price, etc. *\u002F",[743,1048,1049],{"class":908}," }\n",[743,1051,1052,1054],{"class":745,"line":770},[743,1053,984],{"class":897},[743,1055,1056],{"class":908}," {\n",[743,1058,1059,1062,1065,1068,1071],{"class":745,"line":776},[743,1060,1061],{"class":897},"  if",[743,1063,1064],{"class":908}," (generation ",[743,1066,1067],{"class":897},"===",[743,1069,1070],{"class":901}," this",[743,1072,1073],{"class":908},".#variantChangeGeneration) {\n",[743,1075,1076,1079,1081,1083,1086],{"class":745,"line":782},[743,1077,1078],{"class":901},"    this",[743,1080,1014],{"class":908},[743,1082,1017],{"class":897},[743,1084,1085],{"class":901}," false",[743,1087,1023],{"class":908},[743,1089,1090,1093,1095,1097,1100],{"class":745,"line":788},[743,1091,1092],{"class":897},"    await",[743,1094,1070],{"class":901},[743,1096,720],{"class":908},[743,1098,1099],{"class":912},"#drainAddToCartQueue",[743,1101,916],{"class":908},[743,1103,1104],{"class":745,"line":794},[743,1105,1106],{"class":908},"  }\n",[743,1108,1109],{"class":745,"line":800},[743,1110,1111],{"class":908},"}\n",[669,1113,1114],{},"Only the latest generation may end the in-flight state and drain the queue. It's the classic pattern for \"cancellable async operation + shared flag.\"",[863,1116,1118],{"id":1117},"_3-the-queue-stores-snapshots-not-variant-ids","3. The queue stores snapshots, not variant IDs",[669,1120,1121,1122,1125],{},"At click time the variant isn't settled, so each queue entry records ",[696,1123,1124],{},"the clues needed to resolve it",":",[726,1127,1129],{"className":888,"code":1128,"language":890,"meta":734,"style":734},"{\n  quantity,             \u002F\u002F quantity at click time\n  generation,           \u002F\u002F generation at click time\n  intendedVariantId,    \u002F\u002F data-variant-id on the selected option (present for single-option products)\n  pendingVariantChange, \u002F\u002F the request promise in flight at click time\n  variantResolutionUrl, \u002F\u002F picker.buildRequestUrl(selected option), a URL that can re-resolve this selection\n}\n",[679,1130,1131,1136,1144,1152,1160,1168,1176],{"__ignoreMap":734},[743,1132,1133],{"class":745,"line":746},[743,1134,1135],{"class":908},"{\n",[743,1137,1138,1141],{"class":745,"line":752},[743,1139,1140],{"class":908},"  quantity,             ",[743,1142,1143],{"class":955},"\u002F\u002F quantity at click time\n",[743,1145,1146,1149],{"class":745,"line":758},[743,1147,1148],{"class":908},"  generation,           ",[743,1150,1151],{"class":955},"\u002F\u002F generation at click time\n",[743,1153,1154,1157],{"class":745,"line":764},[743,1155,1156],{"class":908},"  intendedVariantId,    ",[743,1158,1159],{"class":955},"\u002F\u002F data-variant-id on the selected option (present for single-option products)\n",[743,1161,1162,1165],{"class":745,"line":770},[743,1163,1164],{"class":908},"  pendingVariantChange, ",[743,1166,1167],{"class":955},"\u002F\u002F the request promise in flight at click time\n",[743,1169,1170,1173],{"class":745,"line":776},[743,1171,1172],{"class":908},"  variantResolutionUrl, ",[743,1174,1175],{"class":955},"\u002F\u002F picker.buildRequestUrl(selected option), a URL that can re-resolve this selection\n",[743,1177,1178],{"class":745,"line":782},[743,1179,1111],{"class":908},[669,1181,1182,1183,1186,1187,1190],{},"The key is ",[679,1184,1185],{},"pendingVariantChange",": the snapshot is bound to the request ",[696,1188,1189],{},"in flight when the user clicked",", not to the picker's latest state at drain time. If the user clicks add and then switches variants again, that queued add still corresponds to the selection at click time.",[863,1192,1194],{"id":1193},"_4-variant-resolution-priority-is-a-pure-function","4. Variant resolution priority is a pure function",[726,1196,1198],{"className":888,"code":1197,"language":890,"meta":734,"style":734},"export function resolveVariantId({ resolvedVariantId, intendedVariantId, hiddenInputValue, available }) {\n  if (available === false) return null;\n  return normalize(resolvedVariantId)   \u002F\u002F ① variant resolved by the snapshot's own request\n      ?? normalize(intendedVariantId)   \u002F\u002F ② data-variant-id on the selected option, never lags\n      ?? normalize(hiddenInputValue)    \u002F\u002F ③ hidden input, trustworthy only after the request completes\n      ?? null;                          \u002F\u002F none → abandon this add\n}\n",[679,1199,1200,1236,1258,1272,1285,1297,1309],{"__ignoreMap":734},[743,1201,1202,1205,1208,1211,1213,1217,1220,1223,1225,1228,1230,1233],{"class":745,"line":746},[743,1203,1204],{"class":897},"export",[743,1206,1207],{"class":897}," function",[743,1209,1210],{"class":912}," resolveVariantId",[743,1212,938],{"class":908},[743,1214,1216],{"class":1215},"sqxcx","resolvedVariantId",[743,1218,1219],{"class":908},", ",[743,1221,1222],{"class":1215},"intendedVariantId",[743,1224,1219],{"class":908},[743,1226,1227],{"class":1215},"hiddenInputValue",[743,1229,1219],{"class":908},[743,1231,1232],{"class":1215},"available",[743,1234,1235],{"class":908}," }) {\n",[743,1237,1238,1240,1243,1245,1247,1250,1253,1256],{"class":745,"line":752},[743,1239,1061],{"class":897},[743,1241,1242],{"class":908}," (available ",[743,1244,1067],{"class":897},[743,1246,1085],{"class":901},[743,1248,1249],{"class":908},") ",[743,1251,1252],{"class":897},"return",[743,1254,1255],{"class":901}," null",[743,1257,1023],{"class":908},[743,1259,1260,1263,1266,1269],{"class":745,"line":758},[743,1261,1262],{"class":897},"  return",[743,1264,1265],{"class":912}," normalize",[743,1267,1268],{"class":908},"(resolvedVariantId)   ",[743,1270,1271],{"class":955},"\u002F\u002F ① variant resolved by the snapshot's own request\n",[743,1273,1274,1277,1279,1282],{"class":745,"line":764},[743,1275,1276],{"class":897},"      ??",[743,1278,1265],{"class":912},[743,1280,1281],{"class":908},"(intendedVariantId)   ",[743,1283,1284],{"class":955},"\u002F\u002F ② data-variant-id on the selected option, never lags\n",[743,1286,1287,1289,1291,1294],{"class":745,"line":770},[743,1288,1276],{"class":897},[743,1290,1265],{"class":912},[743,1292,1293],{"class":908},"(hiddenInputValue)    ",[743,1295,1296],{"class":955},"\u002F\u002F ③ hidden input, trustworthy only after the request completes\n",[743,1298,1299,1301,1303,1306],{"class":745,"line":776},[743,1300,1276],{"class":897},[743,1302,1255],{"class":901},[743,1304,1305],{"class":908},";                          ",[743,1307,1308],{"class":955},"\u002F\u002F none → abandon this add\n",[743,1310,1311],{"class":745,"line":782},[743,1312,1111],{"class":908},[669,1314,1315,1316,1319,1320,1323,1324,1327],{},"This is illustrative: the source checks each value with its own ",[679,1317,1318],{},"if",", not a ",[679,1321,1322],{},"??"," chain, and ",[679,1325,1326],{},"normalizeVariantId"," also treats whitespace-only strings as missing.",[669,1329,1330],{},"A few things to note:",[1332,1333,1334,1345,1354],"ul",{},[1335,1336,1337,1344],"li",{},[696,1338,1339,1340,1343],{},"Returning ",[679,1341,1342],{},"null"," means abandon."," Better to add nothing than to submit a stale, empty or maxed-out variant ID;",[1335,1346,1347,1350,1351,1353],{},[696,1348,1349],{},"The hidden input is only read for the latest generation."," For an older snapshot ",[679,1352,1342],{}," is passed instead, because the input then belongs to a different selection; availability likewise only falls back to \"is the button disabled\" for the latest generation;",[1335,1355,1356,1359,1360,1363,1364,1367,1368,1371,1372,1375],{},[696,1357,1358],{},"What if the snapshot's request was cancelled?"," If the user clicked add and then switched variants again, the snapshot's promise rejects because of the abort; the source's ",[679,1361,1362],{},"catch"," does not distinguish why the promise rejected, so a network failure or any other rejection takes the same path. It then ",[696,1365,1366],{},"requests once more"," using ",[679,1369,1370],{},"variantResolutionUrl"," and reads the variant ID and availability from the JSON inside ",[679,1373,1374],{},"variant-picker"," in the returned HTML; if that request fails, the selection is treated as unavailable.",[726,1377,1379],{"className":737,"code":1378,"language":739,"meta":734,"style":734},"flowchart TB\n  accTitle: Horizon 4.2.0 variant resolution priority when draining the queue\n  accDescr: If the snapshot's request rejected (e.g. aborted or a network failure), the selection is re-resolved via variantResolutionUrl; resolveVariantId then returns null when unavailable, otherwise takes the snapshot's resolved variant, the selected option's data-variant-id, then the hidden input, and abandons the add if none is present.\n  snap[\"One snapshot\u003Cbr\u002F>from the queue\"] --> aborted{\"Snapshot's\u003Cbr\u002F>pendingVariantChange\u003Cbr\u002F>rejected (e.g. aborted)?\"}\n  aborted -->|Yes| refetch[\"Request once more\u003Cbr\u002F>with variantResolutionUrl\"]\n  refetch --> refetchOk{\"Re-request\u003Cbr\u002F>succeeded?\"}\n  refetchOk -->|Yes| readJson[\"Read variant ID\u003Cbr\u002F>and availability from\u003Cbr\u002F>the JSON in variant-picker\"]\n  refetchOk -->|\"No, treated\u003Cbr\u002F>as unavailable\"| giveUp[\"Return null,\u003Cbr\u002F>abandon this add\"]\n  aborted -->|No| avail\n  readJson --> avail{\"available\u003Cbr\u002F>=== false?\"}\n  avail -->|Yes| giveUp\n  avail -->|No| pick[\"Take the first value present:\u003Cbr\u002F>① variant resolved by the snapshot's own request\u003Cbr\u002F>② data-variant-id on the selected option\u003Cbr\u002F>③ hidden input, read only for the latest generation\"]\n  pick --> found{\"Any value\u003Cbr\u002F>present?\"}\n  found -->|Yes| use[\"Use that variant ID\"]\n  found -->|No| giveUp\n",[679,1380,1381,1386,1391,1396,1401,1406,1411,1416,1421,1426,1431,1436,1441,1446,1451],{"__ignoreMap":734},[743,1382,1383],{"class":745,"line":746},[743,1384,1385],{},"flowchart TB\n",[743,1387,1388],{"class":745,"line":752},[743,1389,1390],{},"  accTitle: Horizon 4.2.0 variant resolution priority when draining the queue\n",[743,1392,1393],{"class":745,"line":758},[743,1394,1395],{},"  accDescr: If the snapshot's request rejected (e.g. aborted or a network failure), the selection is re-resolved via variantResolutionUrl; resolveVariantId then returns null when unavailable, otherwise takes the snapshot's resolved variant, the selected option's data-variant-id, then the hidden input, and abandons the add if none is present.\n",[743,1397,1398],{"class":745,"line":764},[743,1399,1400],{},"  snap[\"One snapshot\u003Cbr\u002F>from the queue\"] --> aborted{\"Snapshot's\u003Cbr\u002F>pendingVariantChange\u003Cbr\u002F>rejected (e.g. aborted)?\"}\n",[743,1402,1403],{"class":745,"line":770},[743,1404,1405],{},"  aborted -->|Yes| refetch[\"Request once more\u003Cbr\u002F>with variantResolutionUrl\"]\n",[743,1407,1408],{"class":745,"line":776},[743,1409,1410],{},"  refetch --> refetchOk{\"Re-request\u003Cbr\u002F>succeeded?\"}\n",[743,1412,1413],{"class":745,"line":782},[743,1414,1415],{},"  refetchOk -->|Yes| readJson[\"Read variant ID\u003Cbr\u002F>and availability from\u003Cbr\u002F>the JSON in variant-picker\"]\n",[743,1417,1418],{"class":745,"line":788},[743,1419,1420],{},"  refetchOk -->|\"No, treated\u003Cbr\u002F>as unavailable\"| giveUp[\"Return null,\u003Cbr\u002F>abandon this add\"]\n",[743,1422,1423],{"class":745,"line":794},[743,1424,1425],{},"  aborted -->|No| avail\n",[743,1427,1428],{"class":745,"line":800},[743,1429,1430],{},"  readJson --> avail{\"available\u003Cbr\u002F>=== false?\"}\n",[743,1432,1433],{"class":745,"line":806},[743,1434,1435],{},"  avail -->|Yes| giveUp\n",[743,1437,1438],{"class":745,"line":812},[743,1439,1440],{},"  avail -->|No| pick[\"Take the first value present:\u003Cbr\u002F>① variant resolved by the snapshot's own request\u003Cbr\u002F>② data-variant-id on the selected option\u003Cbr\u002F>③ hidden input, read only for the latest generation\"]\n",[743,1442,1443],{"class":745,"line":818},[743,1444,1445],{},"  pick --> found{\"Any value\u003Cbr\u002F>present?\"}\n",[743,1447,1448],{"class":745,"line":824},[743,1449,1450],{},"  found -->|Yes| use[\"Use that variant ID\"]\n",[743,1452,1453],{"class":745,"line":830},[743,1454,1455],{},"  found -->|No| giveUp\n",[669,1457,1458,1459,720],{},"The source comment calls this the \"#2756 fix\" (without saying whether that's an issue or a PR number) and explains that extracting a pure function makes it ",[696,1460,1461],{},"unit-testable without a DOM or component harness",[863,1463,1465],{"id":1464},"_5-quantity-is-renormalized-for-the-new-variant","5. Quantity is renormalized for the new variant",[669,1467,1468,1469,1472,1473,1219,1476,1219,1479,1482,1483,1486],{},"Different variants can have different minimums, increments and maximums (B2B quantity rules). The snapshot's quantity was entered against the old variant, so at drain time it finds the ",[679,1470,1471],{},"quantity-selector-component"," quantity input in the HTML that belongs to the snapshot (the original request or the re-resolution), reads ",[679,1474,1475],{},"min",[679,1477,1478],{},"max",[679,1480,1481],{},"step"," and ",[679,1484,1485],{},"data-cart-quantity"," (quantity already in the cart), then normalizes:",[726,1488,1490],{"className":888,"code":1489,"language":890,"meta":734,"style":734},"\u002F\u002F effective max = max(max - quantity already in cart, min)\n\u002F\u002F round down to the step, then clamp to [min, effective max]\nif ((quantity - min) % step !== 0) normalized = min + Math.floor((quantity - min) \u002F step) * step;\nreturn Math.max(min, Math.min(effectiveMax ?? Infinity, normalized));\n",[679,1491,1492,1497,1502,1563],{"__ignoreMap":734},[743,1493,1494],{"class":745,"line":746},[743,1495,1496],{"class":955},"\u002F\u002F effective max = max(max - quantity already in cart, min)\n",[743,1498,1499],{"class":745,"line":752},[743,1500,1501],{"class":955},"\u002F\u002F round down to the step, then clamp to [min, effective max]\n",[743,1503,1504,1506,1509,1512,1515,1518,1521,1524,1527,1530,1532,1535,1538,1541,1544,1547,1549,1551,1554,1557,1560],{"class":745,"line":758},[743,1505,1318],{"class":897},[743,1507,1508],{"class":908}," ((quantity ",[743,1510,1511],{"class":897},"-",[743,1513,1514],{"class":908}," min) ",[743,1516,1517],{"class":897},"%",[743,1519,1520],{"class":908}," step ",[743,1522,1523],{"class":897},"!==",[743,1525,1526],{"class":901}," 0",[743,1528,1529],{"class":908},") normalized ",[743,1531,1017],{"class":897},[743,1533,1534],{"class":908}," min ",[743,1536,1537],{"class":897},"+",[743,1539,1540],{"class":908}," Math.",[743,1542,1543],{"class":912},"floor",[743,1545,1546],{"class":908},"((quantity ",[743,1548,1511],{"class":897},[743,1550,1514],{"class":908},[743,1552,1553],{"class":897},"\u002F",[743,1555,1556],{"class":908}," step) ",[743,1558,1559],{"class":897},"*",[743,1561,1562],{"class":908}," step;\n",[743,1564,1565,1567,1569,1571,1574,1576,1579,1581,1584],{"class":745,"line":764},[743,1566,1252],{"class":897},[743,1568,1540],{"class":908},[743,1570,1478],{"class":912},[743,1572,1573],{"class":908},"(min, Math.",[743,1575,1475],{"class":912},[743,1577,1578],{"class":908},"(effectiveMax ",[743,1580,1322],{"class":897},[743,1582,1583],{"class":901}," Infinity",[743,1585,1586],{"class":908},", normalized));\n",[863,1588,1590],{"id":1589},"_6-merged-into-one-request","6. Merged into one request",[669,1592,1593,1594,1597,1598,1601,1602,1605,1606,1609,1610,1613,1614,1616],{},"All resolved queue entries are submitted in ",[696,1595,1596],{},"one"," POST to ",[679,1599,1600],{},"Theme.routes.cart_add_url"," (an ",[679,1603,1604],{},"items"," array in the JSON body), with the ",[679,1607,1608],{},"sections"," parameter bringing back the HTML of the sections that own each ",[679,1611,1612],{},"cart-items-component"," on the page. Even if the user clicked add three times while the request was in flight, there's one add request and one cart refresh; if every entry resolves to ",[679,1615,1342],{},", no request is sent.",[863,1618,1620],{"id":1619},"_7-the-user-doesnt-notice-the-queue","7. The user doesn't notice the queue",[669,1622,1623,1624,1627],{},"On enqueue, the button still calls ",[679,1625,1626],{},"animateAddToCart()",". From the user's point of view the click gets immediate feedback, and the wait behind it is hidden.",[684,1629,1631],{"id":1630},"things-worth-questioning","Things worth questioning",[1332,1633,1634,1643,1659,1665],{},[1335,1635,1636,1642],{},[696,1637,1638,1641],{},[679,1639,1640],{},"product-form.js"," is 1122 lines."," Add to cart, the queue, post-switch UI updates, B2B quantities and error messages all live in one class, which makes it expensive to read. Extracting variant resolution into a pure function is a good start; queue management deserves its own module too.",[1335,1644,1645,1648,1649,1651,1652,1654,1655,1658],{},[696,1646,1647],{},"Animating on enqueue can mislead when the add is finally abandoned."," If resolution ends in ",[679,1650,1342],{}," (the selected variant is unavailable), the animation has already played but nothing was added. The comment on ",[679,1653,1099],{}," explains that an unavailable selection disables the button in ",[679,1656,1657],{},"#onProductSelect",", so no further UI change is needed. But in the window where the button was enabled at click time and unavailability only shows up at drain time, the user sees an add-to-cart success animation.",[1335,1660,1661,1664],{},[696,1662,1663],{},"Re-resolution costs another request."," When the snapshot's request was cancelled by a later switch, the section HTML has to be fetched again. It's a correctness-first trade-off, but on a poor network it stretches the add-to-cart time further.",[1335,1666,1667,881,1670,1672],{},[696,1668,1669],{},"Queue entries are resolved serially.",[679,1671,1099],{}," awaits each entry in a loop, so when several snapshots need re-resolution, the requests go out one after another.",[684,1674,1676],{"id":1675},"summary","Summary",[669,1678,1679,1680,1683],{},"The hard part of this problem isn't technical; it's ",[696,1681,1682],{},"realizing it exists",". It's nearly impossible to reproduce on a fast network, only hits users on slow networks who act quickly, and shows up as \"the wrong item was added,\" which is hard to attribute to theme code.",[669,1685,1686],{},"Horizon's solution boils down to four rules that apply to any \"asynchronously updated form + submit\" scenario:",[1688,1689,1690,1693,1696,1699],"ol",{},[1335,1691,1692],{},"Broadcast as soon as the state change begins, with a promise for the result;",[1335,1694,1695],{},"Guard shared flags with a generation counter;",[1335,1697,1698],{},"On submit, save an \"intent snapshot,\" not the current values;",[1335,1700,1701],{},"Extract the decision logic into a pure function and test it on its own.",[669,1703,1704],{},"Horizon's LICENSE.md forbids distributing themes derived from its code; this article only analyzes the source, so implement any borrowed ideas yourself.",[1706,1707,1708],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .sD7c4, html code.shiki .sD7c4{--shiki-default:#D73A49}html pre.shiki code .sYu0t, html code.shiki .sYu0t{--shiki-default:#005CC5}html pre.shiki code .sgsFI, html code.shiki .sgsFI{--shiki-default:#24292E}html pre.shiki code .s7eDp, html code.shiki .s7eDp{--shiki-default:#6F42C1}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .sqxcx, html code.shiki .sqxcx{--shiki-default:#E36209}",{"title":734,"searchDepth":752,"depth":752,"links":1710},[1711,1712,1713,1722,1723],{"id":686,"depth":752,"text":687},{"id":723,"depth":752,"text":724},{"id":860,"depth":752,"text":861,"children":1714},[1715,1716,1717,1718,1719,1720,1721],{"id":865,"depth":758,"text":866},{"id":977,"depth":758,"text":978},{"id":1117,"depth":758,"text":1118},{"id":1193,"depth":758,"text":1194},{"id":1464,"depth":758,"text":1465},{"id":1589,"depth":758,"text":1590},{"id":1619,"depth":758,"text":1620},{"id":1630,"depth":752,"text":1631},{"id":1675,"depth":752,"text":1676},"dtc",[],"historical","A Horizon 4.2.0 source walkthrough of what happens when a shopper switches variants and clicks add to cart before the section request returns: a ProductSelectEvent carrying a promise, a generation counter, a queue of intent snapshots, pure-function variant resolution, quantity renormalized for the new variant and a single batched POST, plus debatable points such as animating on enqueue.",[1729],"storefront-experience","partial","md",[1733],"intent",[],true,[],{},[],[],[],[17,13],[1743],"developer",{"title":659,"description":1727},[711,717,874,1746],"https:\u002F\u002Fgithub.com\u002FShopify\u002Fhorizon\u002Fblob\u002F5acd1b6b66c02f61d3216e3adace5dd9e0404fc9\u002Fsnippets\u002Fscripts.liquid",[1748],"convert","published","shopify\u002Fthemes\u002Fhorizon\u002Fadd-to-cart-race",[1752,1753,1754,1755,1756,1757],"Horizon","Shopify","Source analysis","4.2.0","Add to cart","Race condition",[1759],{"theme":1760,"version":1761,"url":675},"horizon","4.2.0 · 5acd1b6b66c02f61d3216e3adace5dd9e0404fc9",[1763],"shopify","2026-10-19",[],"Static reading of assets\u002Fproduct-form.js, assets\u002Fvariant-resolution.js, assets\u002Fvariant-picker.js and the importmap in snippets\u002Fscripts.liquid at Horizon 4.2.0 commit 5acd1b6. No store, theme editor or browser testing; the race was not reproduced on a slow network.","2026-10-07","9pbcgCKFsAmqem8R4HTpGuA0hb1VswJGTWFZ_R8sGv8",{"topic":1770,"paths":1772},{"title":1771,"path":29},"Storefront and experience",[],[1774,1776],{"title":1775,"path":17},"Horizon's Section Refresh and Morph: SectionRenderer Concurrency and DOM Merging",{"title":1777,"path":13},"Horizon's Web Components Base Class: Refs, on: Event Delegation, and the Upgrade Race",{"titles":1779,"toolNames":1780,"domainPaths":1793,"reverse":1794},{},{"elevar":1781,"google-ads":1782,"google-analytics":1783,"google-merchant-center":1784,"google-tag-manager":1785,"gorgias":1786,"judge-me":1787,"klaviyo":1788,"meta-ads":1789,"paypal":1790,"shopify":1753,"woocommerce":1791,"wordpress":1792},"Elevar","Google Ads","Google Analytics","Google Merchant Center","Google Tag Manager","Gorgias","Judge.me","Klaviyo","Meta Ads","PayPal","WooCommerce","WordPress",[20,21,22,23,24,25,26,27,28,29],{"implements":1795,"measuredBy":1796,"needs":1797,"constrainedBy":1798},[],[],[],[],1792741304303]