Dev: Overview

The Refactor Back in Stock helper gives you a JavaScript API to manage back-in-stock notification subscriptions directly from your Shopify theme. It works on all devices and browsers. All subscription data is stored in Shopify customer metafields — no external database required.

Once the App Embed Extension is activated, the entire API is available through a single global object:

window.refactor_apps.back_in_stock

You can verify the helper is loaded by running this in the browser console:

window.refactor_apps.back_in_stock.isReady; // → true

What the helper does

Subscription management.

Subscribe or unsubscribe a user from a product variant — either by email or by Shopify customer ID. You can also check whether a specific user is already subscribed to a variant before showing subscribe/unsubscribe UI.

Reading subscription data.

Fetch all subscribers for a given variant, or get all variants a specific customer is subscribed to.

DOM events.

Listen for subscribe, unsubscribe, and ready events on document    to react to state changes in your theme code.

How data is stored

Active subscriptions are stored in a Shopify customer metafield as JSON:

  • Namespace: refactor_back_in_stock   
  • Key: subscribed-variants   
  • Value: {"47891249692922": true}   

You can read this metafield directly in Liquid to conditionally render subscribe/unsubscribe UI on the server side without any JavaScript calls.



Do you need help?

If you have any questions or run into issues, please contact us — we’re happy to help.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us