From 526bcf8e9b54e1b7e284a85a98f937e9687259ba Mon Sep 17 00:00:00 2001 From: Parth Shah Date: Tue, 24 Feb 2026 16:45:06 -0500 Subject: [PATCH 1/2] feat(sd): SD-11467 Fix misc. crashes --- CHANGELOG.md | 1 + assets/js/theme/common/product-details-base.js | 3 ++- templates/layout/base.html | 8 +++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dcf2ee3e2..ea1bd538ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Draft +- Fix `onThemeBundleMain` binding to `window` load instead of script element, guard `optionChangeDecorator` against null response on error, and fix `updateWalletButtonsView` crash on cart edit modal [#2615](https://github.com/bigcommerce/cornerstone/pull/2615) - Add to Cart and quantity buttons disabled when BCData is empty [#2612](https://github.com/bigcommerce/cornerstone/pull/2612) - Introduce strikethrough display for discounted shipping quote prices on cart page [#2611](https://github.com/bigcommerce/cornerstone/pull/2611) - Render native language names on storefront using Intl.DisplayNames [#2607](https://github.com/bigcommerce/cornerstone/pull/2607) diff --git a/assets/js/theme/common/product-details-base.js b/assets/js/theme/common/product-details-base.js index c2c9c8a550..5c4588737d 100644 --- a/assets/js/theme/common/product-details-base.js +++ b/assets/js/theme/common/product-details-base.js @@ -17,6 +17,7 @@ const optionsTypesMap = { export function optionChangeDecorator(areDefaultOptionsSet) { return (err, response) => { + if (err) return; const attributesData = response.data || {}; const attributesContent = response.content || {}; @@ -393,7 +394,7 @@ export default class ProductDetailsBase { updateWalletButtonsView(data) { const viewModel = this.getViewModel(this.$scope); - const isValidForm = viewModel.$addToCartForm[0].checkValidity(); + const isValidForm = viewModel.$addToCartForm?.[0]?.checkValidity() ?? true; this.toggleWalletButtonsVisibility(isValidForm && data.purchasable && data.instock); } diff --git a/templates/layout/base.html b/templates/layout/base.html index 6bbb2dae19..d9bcd1de6f 100644 --- a/templates/layout/base.html +++ b/templates/layout/base.html @@ -85,9 +85,11 @@ const scriptElement = document.getElementById('theme-bundle-main'); if (scriptElement) { - addEventListener('load', onThemeBundleMain); - } else { - console.error('Could not find script element with id "theme-bundle-main"'); + if (typeof window.stencilBootstrap === 'function') { + onThemeBundleMain(); + } else { + scriptElement.addEventListener('load', onThemeBundleMain, { once: true }); + } } From 6859da195ed6290137e056aa2f483ab72b718f23 Mon Sep 17 00:00:00 2001 From: Parth Shah Date: Mon, 2 Mar 2026 14:47:49 -0500 Subject: [PATCH 2/2] SD-11467: fix(sd) - Restore console error for missing theme-bundle-main element --- templates/layout/base.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/layout/base.html b/templates/layout/base.html index d9bcd1de6f..60f2442c0e 100644 --- a/templates/layout/base.html +++ b/templates/layout/base.html @@ -90,6 +90,8 @@ } else { scriptElement.addEventListener('load', onThemeBundleMain, { once: true }); } + } else { + console.error('Could not find script element with id "theme-bundle-main"'); }