Integrations

How to Add a Size Widget to BigCommerce

Script injection, page placement, and cross-theme testing for a size widget that actually ships

On this page
  1. Why BigCommerce Integration Isn't Just "Paste a Script Tag"
  2. Script Injection Through BigCommerce Script Manager
  3. Placing the Widget on the Product Page
  4. Testing Across Themes and Devices Before Launch
  5. Where YourSizer Fits
  6. Frequently Asked Questions
  7. Conclusion

BigCommerce doesn't have a native app-store pattern as tightly enforced as Shopify's, which means a size-recommendation widget can be added in more than one way — and most of the wrong ways only fail once a shopper hits a specific theme or device. Getting the script placement and page targeting right the first time saves a week of "why isn't it showing on mobile" tickets.

BigCommerce merchants sit in an unusual spot: the platform is flexible enough to allow raw script injection through the Script Manager, but that same flexibility means a size widget can end up loaded on every page, blocking render, or duplicated across Stencil theme variations if the setup isn't deliberate. This post walks through the actual mechanics — where the script goes, how to scope it to product pages, and how to confirm it survives theme customization — rather than a generic "install our app" pitch.

Why BigCommerce Integration Isn't Just "Paste a Script Tag"

BigCommerce's Stencil theme engine renders product pages from Handlebars templates, and most stores customize those templates over time — adding custom fields, rearranging the buy box, or swapping in a page-builder section. A size widget that assumes a fixed DOM structure (say, always inserting right after .productView-options) can silently fail to appear on a customized theme, or appear in the wrong spot entirely.

The safer approach is to treat the widget as two separate concerns: loading the script (once, globally, asynchronously) and mounting the widget UI (only on product pages, targeted by a stable selector or a designated container element). Conflating the two is the most common cause of widgets that "worked in the demo store" but broke on the client's actual theme.

Script Injection Through BigCommerce Script Manager

BigCommerce's built-in Script Manager (Storefront > Script Manager in the control panel) is the recommended path for adding third-party scripts — it's designed exactly for this and avoids editing theme files directly, which means the script survives theme updates.

A few practical settings matter:

SettingRecommended valueWhy
LocationHead or FooterFooter avoids blocking initial paint
Load methodAsync/deferPrevents the widget script from delaying page render
Page placement"Storefront pages" scoped to product pages, or "All pages" with in-script path checkingAvoids loading widget JS on cart, checkout, blog pages
Script categoryEssential vs. AnalyticsEssential ensures it isn't blocked by consent-management defaults tuned for analytics scripts

If Script Manager's page-placement rules aren't granular enough for the store's URL structure, load the script globally but defer initialization with a runtime check — most size-widget SDKs expose an init() call that can be gated behind if (window.location.pathname.includes('/products/')) or a check against BigCommerce's context.page_type object exposed in Stencil templates.

Placing the Widget on the Product Page

Product-page placement is where most of the visible failures happen. BigCommerce Stencil themes (Cornerstone and its forks) generally expose a consistent buy-box structure, but "generally" isn't "always" once a merchant has installed a theme customization.

Two placement strategies work reliably:

  • Anchor to a stable, theme-provided element. Cornerstone-based themes typically keep an .productView-options or .form-action-addToCart container; inserting immediately before the Add to Cart button keeps the widget visually tied to sizing decisions without depending on exact spacing.
  • Use a designated placeholder div. For merchants comfortable with a small template edit, adding an empty <div id="size-widget-mount"> in templates/components/products/product-view.html (or the page-builder equivalent) gives the script a guaranteed, stable target regardless of future theme tweaks. This is the more durable option if the store expects to change themes.

Avoid selector strategies based on text content or nth-child position — both break the moment a merchant reorders the buy box or adds a subscription-options block above it.

Testing Across Themes and Devices Before Launch

A script that renders correctly on Cornerstone's default demo theme is not proof it works on the merchant's live theme. Before calling the integration done, verify on: the actual production theme (not the sandbox theme), a page-builder-edited product page if the merchant uses BigCommerce's visual page builder, and at least one mobile viewport, since Stencil's responsive breakpoints can hide or collapse the buy box container the widget anchors to.

A simple pre-launch checklist:

  1. Widget appears on a standard simple product.
  2. Widget appears on a product with variants/options (size widgets often need to react to variant selection).
  3. Widget does not appear on cart, checkout, or blog pages if scoped that way.
  4. No console errors on load, and no layout shift that pushes the Add to Cart button off-screen on mobile.
  5. Widget still renders after a hard refresh and after client-side navigation (BigCommerce's Cornerstone uses some AJAX cart/quick-view behavior that can skip a full page load).

That last point catches a surprising number of bugs — widgets initialized only on DOMContentLoaded can go missing after a quick-view modal or AJAX-driven variant change, since no full page load fires afterward.

Where YourSizer Fits

YourSizer's script is designed to be dropped into BigCommerce's Script Manager without theme-file edits for most Cornerstone-based stores, and it mounts against a configurable selector so merchants with customized buy boxes aren't stuck editing templates. For stores running a heavily modified theme or a page-builder layout, we support the placeholder-div approach described above, which keeps mount behavior stable across future theme changes. Sizing logic runs client-side and reacts to variant selection, so the widget stays in sync when a shopper switches color or style rather than only firing once on initial load — the same mechanics covered in how AI try-on works with diffusion models apply to how the recommendation engine reads product and variant context.

Frequently Asked Questions

Does adding a size widget slow down my BigCommerce store?

It can, if the script blocks render or loads synchronously in the head. Loading it async or deferred through Script Manager, and scoping it to product pages only, keeps the impact minimal — most well-built size widgets add well under a few hundred milliseconds and don't touch Core Web Vitals metrics that matter for SEO or conversion, since they mount after the primary product content has already painted.

Will a size widget work with BigCommerce's Page Builder product pages?

Yes, but placement needs a small adjustment. Page Builder lets merchants rearrange product-page sections visually, which means a widget anchored to a fixed CSS selector can end up in an unexpected spot or fail to find its anchor at all. The placeholder-div approach, where a merchant drops a designated widget block into the Page Builder layout directly, is the more resilient option for stores actively using that editor.

How is a BigCommerce size widget different from installing an app on Shopify?

BigCommerce doesn't enforce app-store-only extensibility the way Shopify's theme-app-extension model increasingly does, so script injection through Script Manager is a fully supported, first-party pattern rather than a workaround. That gives more control over exactly where and when the widget loads, but it also puts more responsibility on the integrator to scope the script correctly — Shopify's app-block model handles some of that scoping automatically.

Conclusion

A size-recommendation widget on BigCommerce succeeds or fails on the details of where the script loads and where it mounts, not on the sizing logic itself. Get script injection scoped correctly through Script Manager, anchor the widget to a stable target rather than a fragile selector, and test across the merchant's actual theme and mobile viewport before calling it live — the payoff is a widget that keeps working through the next theme tweak instead of one that needs re-fixing every quarter.

Put it into practice

See YourSizer on your own store

Size recommendation, 3D body model and photo try-on — live on your product pages in a day.