Bug: themes_support/option_selection.js now ships with "use strict" but contains an undeclared variable, breaking Add to Cart on Timber/Turbo-lineage themes

Short description of issue

Shopify’s platform-served option_selection.js is now wrapped in “use strict” but still contains an undeclared loop variable, throwing ReferenceError on every product page and breaking Add to Cart on Timber/Turbo-lineage themes.

Link to Shopify Store

Reproduction steps

  1. Load any product page on a theme that includes {{ ‘option_selection.js’ | shopify_asset_url }} and calls Shopify.OptionSelectors (Timber or Turbo lineage).

  2. Open the browser console. It shows:
    Uncaught ReferenceError: property is not defined
    at Shopify.Product.update (option_selection-63f7b8ee.js)
    at new Shopify.Product
    at new Shopify.OptionSelectors

  3. Click Add to Cart. Nothing happens. No request is made to /cart/add.js. The variant selector and price UI also fail to initialize, since the throw aborts product section init before any of it binds.

  4. Confirm the cause by predeclaring the global before option_selection.js loads:

The error clears and Add to Cart, variant switching, and price updates all work again with no other changes.

  1. Confirm the regression is the strict wrapper by comparing the two versions Shopify serves:
    https://cdn.shopify.com/s/shopify/option_selection.js (legacy path, no “use strict”, works)
    https://cdn.shopify.com/shop

Additional info

Scope: not store-specific. Any theme loading the file via {{ ‘option_selection.js’ | shopify_asset_url }} gets the same bytes and breaks identically. Timber and Turbo lineage, and anything using Shopify.OptionSelectors.

The offending code:
Shopify.Product.prototype.update = function(json){ for(property in json){ this[property]=json[property] } }

property has no var, let, or const. Under “use strict” that is a hard ReferenceError on the first iteration.

This has been in the file for years and was harmless in sloppy mode. Wrapping it in “use strict”;(()=>{…})() turned a latent quirk into a fatal error.

Fix: for (var property in json), or drop “use strict” from this legacy file.

Easy to miss because the throw happens before the Add-to-Cart handler binds, so the button silently does nothing. Shop Pay is unaffected, so orders keep arriving and the store looks healthy from the admin.

Workaround: before the include.

What type of topic is this

Bug report

Upload screenshot(s) of issue

Hi @Robert_Lucas, thanks for reporting this. The change that caused option_selection.js to be served with "use strict" was mitigated. If you’re still encountering this problem, please let us know so we can investigate further.