this tracker is inline). ORing both (not preferring one)
// matches the bundle and is correct even if the live set is an empty array. Both
// hold integer ids; the click-time id comes off a DOM input (.value → string) or
// selected_variant_id, so coerce with Number for a like-typed compare.
is_preorder_variant: (function () {
var vid = Number(variantId);
var has = function (a) { return Array.isArray(a) && a.indexOf(vid) !== -1; };
return has(_sqTrack.preorderVariantIds) ||
has(_sqTrack.cachedPreorderVariantIds &&
_sqTrack.cachedPreorderVariantIds.preorder_variant_ids);
})(),
// Narrow, authoritative preorder signal: enrolled in an ENABLED STOQ selling plan
// (is_preorder_variant above is the broad OOS+continue heuristic — non-STOQ too).
in_enabled_plan: !!_sqPlan,
// In-stock preorder signal: en
814783,57602995847551,57602995880319,57602995913087,57602995945855,57602995978623,57602996011391,57602996044159,57602996076927,57602996109695,57602996142463,57602996175231,57602996207999,57602996240767,57602996273535,57602996306303,57602996339071,57602996371839,57602996404607,57602996437375,57602996470143,57602996502911,57602996535679,57602996568447,57602996601215,57602996633983,57602996666751,57602996699519,57602996732287,57602996765055,57602996797823,57602996830591,57602996863359,57602996928895,57602996961663,57602996994431,57602997027199,57602997059967,57602997092735,57602997223807,57602997256575,57602997289343,57602997322111,57602997354879,57602997387647,57602997420415,57602997453183,57602997485951,57602997518719,57602997715327,57602997879167,57602998075775,57602998206847,57602998239615,57602998337919,57602998370687,57602998403455,57602998501759,57602998534527,57602998600063,57602998894975,57602998960511,57602999026047,57602999124351,57602999157119,57602999189887,57602999222655,57603001090431,576030011231
70207,54945311326591,54945311359359,54945311392127,54945311424895,54945311457663,54945311490431,54945311523199,54945337540991,54945337704831,54945337803135,54945337835903,54945337868671,54945337901439,54945337966975,54945338032511,54945338098047,54945351631231,54945351663999,54945351762303,54945351795071,54945378140543,54945378173311,54945378206079,54945378238847,54945378271615,54945378304383,54945378337151,54945380925823,54945380958591,54945380991359,54945381024127,54945381056895,54945381089663,54945381122431,54945391444351,54945391477119,54945391509887,54945395310975,54945395343743,54945395376511,54945399275903,54945399308671,54945399341439,54945399374207,54945399406975,54945399439743,54945399472511,54945399505279,54945399538047,54945399570815,54945399603583,54945399636351,54945431683455,54945431716223,54945431748991,54945431781759,54945431814527,54945431847295,54945431880063,54945433125247,54945433158015,54945436467583,54945436500351,54945436533119,54945436565887,54945436598655,54945436631423,5494543666419
PayPal
Plan.shopify_selling_plan_id || _sqPlan.shopify_selling_plan_group_id)) || '',
enrolled_plan_provider: (_sqPlan && _sqPlan.inventory_provider) || '',
block_enabled: !!(_sqTrack.cachedSettings && _sqTrack.cachedSettings.block_accelerated_checkout),
gate_armed: !!_sqTrack.acceleratedGateArmed,
gate_active_at_click: !!(document.documentElement &&
document.documentElement.classList.contains('stoq-buy-now-pending')),
},
});
} catch (err) { /* never break checkout */ }
}, true);
}
} catch (e) { /* fail open */ }
function applyTranslations(settings) {
try {
// Skip translation logic entirely if multi-language is not enabled
if (!settings || !settings.multi_language_enabled) {
return settings;
}
if (!settings.translations) {
console.debug('STOQ - No translations found, skipping translation');
return settings;
}
const normalizedLocale = w
fig.cachedVariantPreorderLimitsMarketKey = "variant_preorder_limits_for_market_382140642";window._RestockRocketConfig.cachedVariantShippingTexts = {"variant_shipping_texts":{},"updated_at":"2026-07-08T21:17:56Z","shopify_market_id":382140642,"market_locations_enabled":false};
window._RestockRocketConfig.cachedVariantShippingTextsMarketKey = "variant_shipping_texts_for_market_382140642";window._RestockRocketConfig.sellingPlans = [{"shopify_selling_plan_group_id":98590196095,"shopify_selling_plan_id":713071886719,"enabled":true,"variant_ids":[55569712382335,55569712415103,55569712480639,55570017616255,55570017550719,55569712447871,55570017583487],"product_variants_source":"custom","name":"Preorder","preorder_button_text":"Preorder","preorder_button_description":"Note: This is a preorder. Items will ship based on the estimated delivery date.","preorder_button_description_enabled":true,"preorder_button_description_background_color":"#ebebeb","preorder_button_description_text_color":"#000000","preorder_button_
945520288127,54945520320895,54945520353663,54945520386431,54945520419199,54945520451967,54945523532159,54945546764671,54945546797439,54945546830207,54945546928511,54945546961279,54945548042623,54945548075391,54945548108159,54945548140927,54945548173695,54945548206463,54945548239231,54945548271999,54945550336383,54945550369151,54945550401919,54945550434687,54945550467455,54945550500223,55038016422271,55196401860991,55196401893759,55196401926527,55196402647423,55196403433855,55196403466623,55196403532159,55196403564927,55196403630463,55196403663231,55196403695999,55196403728767,55196403794303,55196403827071,55196403859839,55196403892607,55196404285823,55196404318591,55196404351359,55196404384127,55196404416895,55196404449663,55196404482431,55196404515199,55196404547967,55196404580735,55196404613503,55196404646271,55196405662079,55196405694847,55196405727615,55196405760383,55196405825919,55196405858687,55196405891455,55196405924223,55196408185215,55196408217983,55196408250751,55196408283519,55196408316287,551964
delete settings.translations;
return settings;
} catch (e) {
console.debug('STOQ - error applying translations:', e);
return settings;
}
}
// Setup event listener for cart selling plan updates
// This must be called before any scripts are loaded to avoid race conditions
function setupCartSellingPlanUpdater(settings) {
// Setup listener regardless - updateCartSellingPlans has its own guards
// This ensures cleanup happens even when preorders are disabled globally
// Listen for stoq:inventory-data-loaded event dispatched by api.js
window.addEventListener('stoq:inventory-data-loaded', function(event) {
console.debug('STOQ - Inventory data loaded, updating cart selling plans');
if (window._RestockRocket && window._RestockRocket.updateCartSellingPlans) {
window._RestockRocket.updateCartSellingPlans()
.then(hasUpdates => {
if (hasUpdates) {
console.debug('STOQ - cart selling plans updated successfully');
Union Pay
4239,55239704347007,55239714374015,55239714505087,55239726596479,55245591871871,55245591970175,55245592002943,55245656818047,55245656949119,55245730152831,55245730218367,55245730316671,55245730349439,55245730382207,55245730447743,55245730578815,55245730742655,55245730775423,55245737492863,55245737623935,55245737656703,55245737689471,55245737722239,55294444142975,55294475927935,55294475960703,55294527504767,55294527537535,55294528946559,55294528979327,55333372789119,55333372821887,55333372854655,55333372887423,55333372920191,55333372952959,55333372985727,55333373018495,55333373051263,55333373084031,55333373116799,55333373182335,55333373215103,55333373280639,55333373313407,55333439340927,55333439373695,55333439406463,55333439439231,55333439471999,55333439504767,55333439537535,55333439570303,55333439603071,55333439635839,55333439668607,55333439701375,55333439734143,55333439766911,55333439832447,55333439865215,55333439897983,55333439930751,55333439963519,55333439996287,55333440061823,55333440094591,55333738185087ory_provider":"stoq","preorder_badge_enabled":false,"preorder_badge_text":"Preorder","preorder_badge_text_color":"#FFFFFF","preorder_badge_background_color":"#000000","preorder_discounted_price_enabled":null,"payment_line_item_property_enabled":false,"shipping_line_item_property_enabled":true,"custom_line_item_property_text":null,"preorder_button_text_color":"#ffffff","preorder_button_background_color":"#565557","preorder_button_colors_enabled":true,"markets_enabled":false,"market_id":13779632354,"shopify_market_ids":[],"use_shopify_selling_plan":true,"use_simplified_shipping_text":false,"translations":{},"payment_options":[{"billing_type":"no_remaining_balance","billing_checkout_charge_type":"percentage","billing_checkout_charge_amount":null,"billing_checkout_charge_percentage":"100.0","billing_at":"2025-07-26T09:20:38.472Z","billing_after_n_intervals":7,"billing_after_interval_type":"day","pricing_type":"no_discount","pricing_amount":null,"pricing_percentage":null,"billing_title":"Full payment","billing_des
Shop Pay
<
82603536767,55482603569535,55482603602303,55482603635071,55482603667839,55482603700607,55482623361407,55482623394175,55482623426943,55482623459711,55482623492479,55482639122815,55482639155583,55482639188351,55482639221119,55482666844543,55482671497599,55482671530367,55482671563135,55482671595903,55482671628671,55482675102079,55482675134847,55482675167615,55482675626367,55482675659135,55482675691903,55482677952895,55482679787903,55482684965247,55553117356415,55553117389183,55553117454719,55553117487487,55553117520255,55553117553023,55553117585791,55570017517951,55585620263295,55585620296063,55585620328831,55585620361599,55664837296511,55664857874815,55664857907583,55664857940351,55664857973119,55664858005887,56051529482623,56051529515391,56051529548159,56051529580927,56051529613695,56063296373119,56063296405887,56063296438655,56063296471423,56063370428799,56063370461567,56063370494335,56063370527103,56063691129215,56140121801087,56140121833855,56140121899391,56140121932159,56140121964927,56166204834175,5616620s. Please complete your current order first, or clear your cart to continue.","b2b_enabled":true,"preorder_progress_bar_enabled":false,"preorder_progress_bar_text":"{{ sold }} of {{ total }} claimed","preorder_progress_bar_fill_color":"#000000","preorder_progress_bar_background_color":"#e5e5e5","preorder_progress_bar_text_color":"#FFFFFF","preorder_progress_bar_border_radius":4,"preorder_progress_bar_show_percentage":false}];(function() {
const cachedData = {"plans":[{"shopify_selling_plan_group_id":98590196095,"shopify_selling_plan_id":713071886719,"enabled":true,"variant_ids":[55569712382335,55569712415103,55569712480639,55570017616255,55570017550719,55569712447871,55570017583487],"product_variants_source":"custom","name":"Preorder","preorder_button_text":"Preorder","preorder_button_description":"Note: This is a preorder. Items will ship based on the estimated delivery date.","preorder_button_description_enabled":true,"preorder_button_description_background_color":"#ebebeb","preorder_button_descriptio
"settings") { value } } }';
fetch(
`https://${cfg.shop}/api/2025-07/graphql.json`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Shopify-Storefront-Access-Token': cfg.storefrontAccessToken,
},
body: JSON.stringify({ query: query, variables: { namespace: cfg.metafieldNamespace } }),
}
)
.then(function(response) {
if (!response.ok) { throw new Error('Storefront API HTTP ' + response.status); }
return response.json();
})
.then(function(body) {
if (body && body.errors && body.errors.length) {
throw new Error('Storefront API errors: ' + body.errors.map(function(e) { return e && e.message; }).join(', '));
}
const value = body && body.data && body.data.shop && body.data.shop.metafield && body.data.shop.metafield.value;
if (!value) { throw new Error('Storefront API returned no settings metafield value'); }
cfg.stoVisa
095,56386096726399,56386096824703,56386096923007,56386096955775,56386097021311,56386097119615,56386097217919,56386097250687,56386097283455,56386097316223,56386097348991,56386097381759,56386097414527,56386097447295,56386097480063,56386097512831,56386097545599,56386097578367,56386097611135,56386097643903,56386097807743,56386097840511,56386097873279,56386097938815,56386098626943,56386098659711,56386098758015,56386098790783,56386098823551,56386098856319,56386098921855,56386098954623,56386099020159,56386099609983,56386099675519,56386099872127,56386100527487,56386100593023,56386100658559,56386101084543,56386101117311,56386101150079,56393228648831,56393228812671,56393231630719,56393231761791,56393231991167,56393232155007,56393232220543,56393232384383,56393232449919,56393232580991,56393232777599,56393232875903,56393232974207,56393233236351,56393233367423,56393233629567,56393233760639,56393234088319,56393234252159,56393234350463,56393234481535,56393234678143,56393235759487,56393238774143,56393238872447,56393239003519,ull,"enable_billing_widget":false,"inventory_provider":"stoq","preorder_badge_enabled":false,"preorder_badge_text":"Preorder","preorder_badge_text_color":"#FFFFFF","preorder_badge_background_color":"#000000","preorder_discounted_price_enabled":null,"payment_line_item_property_enabled":false,"shipping_line_item_property_enabled":true,"custom_line_item_property_text":null,"preorder_button_text_color":"#ffffff","preorder_button_background_color":"#565557","preorder_button_colors_enabled":true,"markets_enabled":false,"market_id":13779632354,"shopify_market_ids":[],"use_shopify_selling_plan":true,"use_simplified_shipping_text":false,"translations":{},"payment_options":[{"billing_type":"no_remaining_balance","billing_checkout_charge_type":"percentage","billing_checkout_charge_amount":null,"billing_checkout_charge_percentage":"100.0","billing_at":"2025-07-26T09:20:38.472Z","billing_after_n_intervals":7,"billing_after_interval_type":"day","pricing_type":"no_discount","pricing_amount":null,"pricing_percentage":null,"b
p'
};
if (window.Shopify?.theme?.role === 'main') {
headers['X-Shopify-Theme-Schema-Name'] = window.Shopify.theme.schema_name;
headers['X-Shopify-Theme-Schema-Version'] = window.Shopify.theme.schema_version;
headers['X-Shopify-Theme-Store-Id'] = window.Shopify.theme.theme_store_id;
}
fetch(
`${window._RestockRocketConfig.host}/api/v1/setting.json?translation_locale=${window._RestockRocketConfig.normalizedLocale}`,
{ headers }
)
.then(function(response) {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(function(settings) {
initializeScripts(settings);
})
.catch(function(error) {
// If request failed and we have cached settings (even if expired), use them as fallback
if (cachedSettings) {
console.debug('STOQ - using expired cached settings as fallback');
initializeScripts(cachedSettings);
} else {
console.error('S
4086914431,56494086947199,56494086979967,56494087045503,56494087078271,56494087111039,56494087143807,56494087176575,56494087209343,56494087242111,56494087274879,56494087307647,56494087340415,56494087373183,56494087405951,56494087504255,56494087537023,56494087799167,56494088356223,56494088454527,56494090289535,56504701485439,56504701518207,56504701550975,56504701583743,56504701616511,56504701649279,56504839209343,56504839242111,56504839274879,56504839307647,56504839340415,56504839373183,56504921981311,56504922014079,56504922046847,56504922079615,56504922112383,56504922145151,56504922177919,56504922210687,56504922243455,56504950489471,56504950522239,56504950555007,56504950587775,56504950620543,56504950653311,56504950686079,56504950718847,56504950751615,56504961139071,56504961171839,56504961204607,56504961237375,56504961270143,56504961302911,56504961335679,56504961368447,56504961401215,56505064489343,56505064522111,56505064554879,56505064587647,56505064620415,56505064653183,56505064685951,56505064718719,56505064be purchased separately from regular items. Please complete your current order first, or clear your cart to continue.","b2b_enabled":true,"preorder_progress_bar_enabled":false,"preorder_progress_bar_text":"{{ sold }} of {{ total }} claimed","preorder_progress_bar_fill_color":"#000000","preorder_progress_bar_background_color":"#e5e5e5","preorder_progress_bar_text_color":"#FFFFFF","preorder_progress_bar_border_radius":4,"preorder_progress_bar_show_percentage":false}],"disabled_plan_ids":[713813721471,713176482175,714631872895],"cached_at":"2026-04-09T09:16:46Z"};
if (cachedData && typeof cachedData === 'object' && cachedData.cached_at) {
// Find the maximum updated_at from all items in old array
const oldPlans = window._RestockRocketConfig.sellingPlans;
const maxUpdatedAt = Array.isArray(oldPlans) && oldPlans.length > 0
? oldPlans.reduce(function(max, plan) {
// Parse dates for proper comparison (handles mixed ISO formats)
if (plan.updated_at)
Union Pay
endpoint + ':', applyError);
throw applyError;
}
})
.catch(function(error) {
console.debug(`STOQ - using cached ${endpoint}:`, error.message);
});
}
function initializeScripts(settings) {
settings = applyTranslations(settings);
window._RestockRocketConfig.settings = settings;
console.debug(`STOQ - settings configured for ${window._RestockRocketConfig.pageType}`);
// Stale-Liquid resilience (default-on, per-shop opt-out via the
// `disable_refresh_on_stale_liquid` Toggle, surfaced as the negative
// `disable_refresh_on_stale_liquid` flag in settings.json so that
// `undefined` -- in CDN-cached metafield payloads that predate this
// key -- reads as `!undefined === true` and gets default-on behavior
// immediately, no metafield rewrite required).
// When the Liquid CDN cache is older than LIQUID_CACHE_MAX_AGE the in-page
// selling_plans / integrations metafields can be wrong; refresh both from
// the API before launching scr
07,56518805717375,56518805750143,56518805782911,56561153933695,56766086054271,56766086185343,56766086250879,56766086381951,56766086447487,56766086513023,56766086840703,56766183342463,56766183375231,56766183407999,56766183440767,56766183473535,56766183506303,56766183539071,56766183571839,56766183637375,56766183670143,56766183768447,56766183801215,56766183833983,56766183932287,56766183965055,56766183997823,56766184030591,56766184096127,56766184128895,56766184161663,57284689789311,57284689822079,57284689854847,57284689887615,57284689920383,57284689953151,57284689985919,57284690018687,57284690051455,57284690084223,57284690116991,57284690149759,57284690182527,57284690215295,57284690248063,57284690313599,57284690346367,57284690379135,57284690411903,57311934513535,57311934546303,57311934579071,57311934611839,57318991724927,57318991790463,57318991823231,57319008797055,57319008829823,57319008862591,57319008895359,57392715465087,57392715497855,57392715530623,57392715563391,57392715596159,57578627137919,57578627170687,5abled_plan_ids || [];
console.debug('[RR] Using selling plans from cachedSellingPlans (cached_at: ' + cachedData.cached_at + ')');
}
} else {
// When using old format (stale cache), don't trust disabled_plan_ids
window._RestockRocketConfig.disabledSellingPlanIds = [];
console.debug('[RR] Using selling plans from old format (max updated_at: ' + maxUpdatedAt + ')');
}
}
})();window._RestockRocketConfig.enabledNotifyMeVariantIds = [];window._RestockRocketConfig.disabledNotifyMeVariantIds = [];window._RestockRocketConfig.backInStockTemplates = [];window._RestockRocketConfig.restockNotes = {};window._RestockRocketConfig.integrations = [{"id":"15c94526-b6b8-4de1-9bc1-23b1ca52ddb0","shop_id":38436,"enabled":true,"page_types":["product","collection","index","search","page","cart","list-collections","article","blog"],"configuration":{"toastDuration":10000,"toastPosition":"bottom-right","enableXHRHijack":true,"enableFetchHijack":true,"quantit
}
}),
fetchEmbedConfig('integrations', function(data) {
if (Array.isArray(data)) {
window._RestockRocketConfig.integrations = data;
}
})
]),
new Promise(function(resolve) { setTimeout(resolve, 1000); })
]).then(function() { loadScripts(settings); });
return;
}
loadScripts(settings);
}
function loadScripts(settings) {
// Setup cart selling plan updater BEFORE loading any scripts to avoid race conditions
setupCartSellingPlanUpdater(settings);
if(settings.enable_app) {
const hijackIntegration = window._RestockRocketConfig.integrations.find(function(integration) {
return integration.type === 'hijack' && integration.enabled && integration.page_types.includes(window._RestockRocketConfig.pageType);
})
// STOQ-1520: serve the lean back-in-stock-only build (no preorder/hijack code)
// only to shops with NO preorder plans. Use the full build if preorder is o
177056127,57596177088895,57596177121663,57596177252735,57596177285503,57596177351039,57596177383807,57596177416575,57596177449343,57596177514879,57596177547647,57596177613183,57596177645951,57596177809791,57596177842559,57596177875327,57596177908095,57602995126655,57602995159423,57602995192191,57602995224959,57602995257727,57602995290495,57602995323263,57602995356031,57602995388799,57602995421567,57602995454335,57602995487103,57602995519871,57602995552639,57602995585407,57602995618175,57602995650943,57602995683711,57602995716479,57602995749247,57602995782015,57602995814783,57602995847551,57602995880319,57602995913087,57602995945855,57602995978623,57602996011391,57602996044159,57602996076927,57602996109695,57602996142463,57602996175231,57602996207999,57602996240767,57602996273535,57602996306303,57602996339071,57602996371839,57602996404607,57602996437375,57602996470143,57602996502911,57602996535679,57602996568447,57602996601215,57602996633983,57602996666751,57602996699519,57602996732287,57602996765055,57602996703cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003eRolling Resistance.\u003c\/strong\u003e\u003cspan data-mce-fragment=\"1\"\u003e \u003c\/span\u003eThe patented, 5mm thick SmartGuard layer, when compared to all generic products, has a significant advantage in rolling resistance. Schwalbe further extended its lead in the latest version.\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003eRecycling.\u003c\/strong\u003e\u003cspan data-mce-fragment=\"1\"\u003e \u003c\/span\u003eAlso in the SmartGuard, Schwalbe now use a proportion of recycled rubber from old latex products.\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003e“Anti-Aging” Side Wall.\u003c\/strong\u003e\u003cspan data-mce-fragment=\"1\"\u003e \u003c\/span\u003eIt now lasts much longer before developing unsightly cracks when subjected to use with too low air pressure.\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrongVisa
onPageTypes = ['collection', 'index', 'search', 'page'];
if(collectionPageTypes.indexOf(pageType) !== -1 && (settings[`show_button_on_${pageType}`] || settings[`preorder_${pageType}_enabled`])) {
createRestockRocketScript(collectionScriptUrl);
} else if(pageType === 'product') {
createRestockRocketScript(productScriptUrl);
} else if(hijackIntegration) {
createRestockRocketScript(window._RestockRocketConfig.scriptUrlCollection);
} else if(usePreorderBuild) {
// cart/article/blog/list-collections: full build so the cart sweep runs.
createRestockRocketScript(window._RestockRocketConfig.scriptUrlCollection);
} else {
console.debug(`STOQ - no scripts enabled for ${pageType}`);
}
// Dispatch custom event when app is loaded
// Cart selling plan updates will be triggered by stoq:inventory-data-loaded event
const appLoadedEvent = new CustomEvent('stoq:loaded', {
detail: {
pageType: window._RestockR
1,57603003253119,57603003285887,57603003318655,57603003351423,57603003384191],"updated_at":"2026-07-08T11:07:22Z","market_locations_enabled":false,"market_id":382140642,"preorder_location_filter_enabled":false,"preorder_location_filter_ids":[],"collection_id":null};window._RestockRocketConfig.cachedOutOfStockVariantIds = { out_of_stock_variant_ids: [] };window._RestockRocketConfig.cachedVariantPreorderLimits = {"variant_preorder_limits":{},"updated_at":"2026-07-08T21:17:56Z","shopify_market_id":382140642,"market_locations_enabled":false};
window._RestockRocketConfig.cachedVariantPreorderLimitsMarketKey = "variant_preorder_limits_for_market_382140642";window._RestockRocketConfig.cachedVariantShippingTexts = {"variant_shipping_texts":{},"updated_at":"2026-07-08T21:17:56Z","shopify_market_id":382140642,"market_locations_enabled":false};
window._RestockRocketConfig.cachedVariantShippingTextsMarketKey = "variant_shipping_texts_for_market_382140642";window._RestockRocketConfig.sellingPlans = [{"shopify_sellng data-mce-fragment=\"1\"\u003e of the team:\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e \u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003e\u003cmeta charset=\"utf-8\"\u003e\n\u003cspan\u003ePerfect for bike packing, touring and gravel bike adventures! Available online or from our bike shop in Edinburgh\u003c\/span\u003e\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003eProjektRide Bike shop Edinburgh.\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003eedinburgh@projektride.co.uk\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003eT- 01313745324\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp\u003e \u003c\/p\u003e","published_at":"2021-12-26T18:41:17+00:00","created_at":"2021-12-26T18:41:15+00:00","vendor":"schwalbe","type":"","tags":["Schwalbe Ma
Close
tion_show_shipping":true,"preorder_button_description_icons_enabled":true,"preorder_shipping_text":"Shipping: {{ date }}","shipping_applies_to_all_products":true,"shipping_text":"Estimated to ship within 2 months","payment_type":"full","billing_checkout_charge_type":"percentage","billing_checkout_charge_amount":null,"billing_checkout_charge_percentage":"100.0","pricing_type":"no_discount","pricing_amount":null,"pricing_percentage":null,"discount_text":"Save {{ discount }}","billing_title":"Full payment","billing_description":null,"enable_billing_widget":false,"inventory_provider":"stoq","preorder_badge_enabled":false,"preorder_badge_text":"Preorder","preorder_badge_text_color":"#FFFFFF","preorder_badge_background_color":"#000000","preorder_discounted_price_enabled":null,"payment_line_item_property_enabled":false,"shipping_line_item_property_enabled":true,"custom_line_item_property_text":null,"preorder_button_text_color":"#ffffff","preorder_button_background_color":"#565557","preorder_button_colors_enabled":trtaxable":true,"featured_image":null,"available":true,"name":"700c Schwalbe Marathon Plus Performance SmartGuard Rigid Endurance Compound Tyre in Black - 700c \/ 28mm","public_title":"700c \/ 28mm","options":["700c \/ 28mm"],"price":4399,"weight":2000,"compare_at_price":4399,"inventory_management":"shopify","barcode":null,"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":42205173055714,"title":"700c \/ 32mm","option1":"700c \/ 32mm","option2":null,"option3":null,"sku":"4026495720625","requires_shipping":true,"taxable":true,"featured_image":null,"available":true,"name":"700c Schwalbe Marathon Plus Performance SmartGuard Rigid Endurance Compound Tyre in Black - 700c \/ 32mm","public_title":"700c \/ 32mm","options":["700c \/ 32mm"],"price":4399,"weight":2000,"compare_at_price":4399,"inventory_management":"shopify","barcode":null,"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":4
e":"text","countdown_timer_text_color":"#000000","countdown_timer_background_color":"#f5f5f5","countdown_timer_border_radius":8,"countdown_timer_format":"DHMS","countdown_timer_use_schedule_dates":true,"countdown_timer_custom_start_date":null,"countdown_timer_custom_end_date":null,"countdown_timer_starts_text":null,"countdown_timer_ends_text":null,"schedule_offer":false,"schedule_start_date":null,"schedule_end_date":null,"updated_at":"2025-08-19T10:05:43.042Z","allow_mixed_cart":true,"mixed_cart_error_message":"Preorders must be purchased separately from regular items. Please complete your current order first, or clear your cart to continue.","b2b_enabled":true,"preorder_progress_bar_enabled":false,"preorder_progress_bar_text":"{{ sold }} of {{ total }} claimed","preorder_progress_bar_fill_color":"#000000","preorder_progress_bar_background_color":"#e5e5e5","preorder_progress_bar_text_color":"#FFFFFF","preorder_progress_bar_border_radius":4,"preorder_progress_bar_show_percentage":false}];(function() {
copify","barcode":null,"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/projektride.co.uk\/cdn\/shop\/products\/644386044_1904.jpg?v=1640544077"],"featured_image":"\/\/projektride.co.uk\/cdn\/shop\/products\/644386044_1904.jpg?v=1640544077","options":["Size"],"media":[{"alt":null,"id":28913845108962,"position":1,"preview_image":{"aspect_ratio":1.089,"height":743,"width":809,"src":"\/\/projektride.co.uk\/cdn\/shop\/products\/644386044_1904.jpg?v=1640544077"},"aspect_ratio":1.089,"height":743,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/products\/644386044_1904.jpg?v=1640544077","width":809}],"requires_selling_plan":false,"selling_plan_groups":[],"content":"\u003cmeta charset=\"utf-8\"\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003eSize - 700c\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003eThe new Flat-less tyre.\
le for preorder","preorder_button_description_show_shipping":true,"preorder_button_description_icons_enabled":true,"preorder_shipping_text":"Shipping: {{ date }}","shipping_applies_to_all_products":true,"shipping_text":"Estimated to ship within 2 months","payment_type":"full","billing_checkout_charge_type":"percentage","billing_checkout_charge_amount":null,"billing_checkout_charge_percentage":"100.0","pricing_type":"no_discount","pricing_amount":null,"pricing_percentage":null,"discount_text":"Save {{ discount }}","billing_title":"Full payment","billing_description":null,"enable_billing_widget":false,"inventory_provider":"stoq","preorder_badge_enabled":false,"preorder_badge_text":"Preorder","preorder_badge_text_color":"#FFFFFF","preorder_badge_background_color":"#000000","preorder_discounted_price_enabled":null,"payment_line_item_property_enabled":false,"shipping_line_item_property_enabled":true,"custom_line_item_property_text":null,"preorder_button_text_color":"#ffffff","preorder_button_background_color":"#56 Side Wall.\u003c\/strong\u003e\u003cspan data-mce-fragment=\"1\"\u003e \u003c\/span\u003eIt now lasts much longer before developing unsightly cracks when subjected to use with too low air pressure.\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003eE-Bike Ready.\u003cspan data-mce-fragment=\"1\"\u003e \u003c\/span\u003e\u003c\/strong\u003eThe main sizes are approved and tested for E-bikes up to 50km\/h. Following sizes carry the ECE-R75 mark:\u003cbr data-mce-fragment=\"1\"\u003e20 x 1.75”, 26 x 1.75”, 700 x 35mm and 700 x 38mm\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003eSmartGuard\u003c\/strong\u003e\u003cbr data-mce-fragment=\"1\"\u003eMost effective protection belt available for bicycle tyres. A substantial, 5mm thick layer of flexible, special india rubber offers durable protection. Works also for objects that lodge in the tread. Even a thumbtack won’t harm it.\u003cbr data-mce-fragment=\"1\"\u003eFlat-
imer_enabled":false,"countdown_timer_style":"text","countdown_timer_text_color":"#000000","countdown_timer_background_color":"#f5f5f5","countdown_timer_border_radius":8,"countdown_timer_format":"DHMS","countdown_timer_use_schedule_dates":true,"countdown_timer_custom_start_date":null,"countdown_timer_custom_end_date":null,"countdown_timer_starts_text":null,"countdown_timer_ends_text":null,"schedule_offer":false,"schedule_start_date":null,"schedule_end_date":null,"updated_at":"2025-08-19T10:05:43.042Z","allow_mixed_cart":true,"mixed_cart_error_message":"Preorders must be purchased separately from regular items. Please complete your current order first, or clear your cart to continue.","b2b_enabled":true,"preorder_progress_bar_enabled":false,"preorder_progress_bar_text":"{{ sold }} of {{ total }} claimed","preorder_progress_bar_fill_color":"#000000","preorder_progress_bar_background_color":"#e5e5e5","preorder_progress_bar_text_color":"#FFFFFF","preorder_progress_bar_border_radius":4,"preorder_progress_bar_show_p\u003e\u003cstrong data-mce-fragment=\"1\"\u003eT- 01313745324\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp\u003e \u003c\/p\u003e"};
window._RestockRocketConfig.variantsInventoryPolicy = {42205172990178 : "deny",42205173022946 : "deny",42205173055714 : "deny",42205173088482 : "deny",42205173121250 : "deny",};
window._RestockRocketConfig.variantsInventoryQuantity = {42205172990178 : parseInt("8"),42205173022946 : parseInt("10"),42205173055714 : parseInt("10"),42205173088482 : parseInt("8"),42205173121250 : parseInt("2"),};
window._RestockRocketConfig.variantsPreorderCount = {42205172990178 : parseInt(""),42205173022946 : parseInt(""),42205173055714 : parseInt(""),42205173088482 : parseInt(""),42205173121250 : parseInt(""),};
window._RestockRocketConfig.variantsPreorderCountForMarket = {42205172990178 : null,42205173022946 : null,42205173055714 : null,42205173088482 : null,42205173121250 : null,};
window._RestockRocketConfig.variantsPreorderMaxCount = {42205172990178 : parseInt(""),422051730
mat differences (+00:00 vs .000Z)
const cachedDate = new Date(cachedData.cached_at);
const maxDate = maxUpdatedAt ? new Date(maxUpdatedAt) : null;
const useCached = !maxUpdatedAt || (cachedDate && !isNaN(cachedDate) && (!maxDate || cachedDate > maxDate));
if (useCached) {
if (Array.isArray(cachedData.plans)) {
window._RestockRocketConfig.sellingPlans = cachedData.plans;
// Only use disabled_plan_ids when using cached plans
window._RestockRocketConfig.disabledSellingPlanIds = cachedData.disabled_plan_ids || [];
console.debug('[RR] Using selling plans from cachedSellingPlans (cached_at: ' + cachedData.cached_at + ')');
}
} else {
// When using old format (stale cache), don't trust disabled_plan_ids
window._RestockRocketConfig.disabledSellingPlanIds = [];
console.debug('[RR] Using selling plans from old format (max updated_at: ' + maxUpdatedAt + ')');
}
}
})12) and the click tracker (STOQ-1595) read one clearly-owned flag rather
// than a side effect buried in either consumer's try/catch: whether this shop has preorders
// configured at all — an enabled selling plan plus at least one preorder variant id,
// independent of the block toggle. Fail-open: on error the flag stays unset and both
// consumers no-op.
try {
var _sqCfg = window._RestockRocketConfig;
var _sqPlanEnabled = Array.isArray(_sqCfg.sellingPlans) &&
_sqCfg.sellingPlans.some(function (p) { return p && p.enabled; });
var _sqPreCount = ((_sqCfg.cachedPreorderVariantIds &&
_sqCfg.cachedPreorderVariantIds.preorder_variant_ids) || []).length;
_sqCfg.preordersConfigured = !!(_sqPlanEnabled && _sqPreCount);
} catch (e) { /* fail open */ }
// STOQ-1612: block (not hide) Buy Now / Shop Pay until our JS runs, so a tap in the
// load window can't bypass preorder. pointer-events via .stoq-buy-now-pending (no
// reflow); timeout releases; renderPreorderButton / fe
atured_product.js lift it.
// Gated by the `block_accelerated_checkout` toggle (default OFF) for gradual rollout.
// Armed ONLY when we're sure preorder is in play — product page: THIS product has a
// preorder variant (never block a plain product's Shop Pay); featured: integration
// enabled for this page type. Rationale: PR #2784.
try {
var _sqc = window._RestockRocketConfig;
var _sqOn = !!(_sqc.cachedSettings && _sqc.cachedSettings.block_accelerated_checkout);
var _sqPre = (_sqc.cachedPreorderVariantIds &&
_sqc.cachedPreorderVariantIds.preorder_variant_ids) || [];
var _sqArm = false;
if (_sqOn && _sqc.preordersConfigured) {
if (_sqc.pageType === 'product' && _sqc.product && _sqc.product.variants) {
_sqArm = _sqc.product.variants.some(function (v) { return _sqPre.indexOf(Number(v.id)) !== -1; });
} else {
_sqArm = (_sqc.integrations || []).some(function (i) {
return i && i.type === 'featured_product' && i.enabled &&
Arra
under great commuting road tyre? Look no further with the Continental Gatorskin tyre.\u003c\/p\u003e\n\u003cp\u003eThe gatorskin provides a super high puncture protection to prevent any unwanted flats along with providing a lot of grip with its high quality, fast-rolling rubber.\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003eIf any more information is needed, please don't hesitate to get in touch with one of the team:\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003eProjektRide Bike shop Edinburgh.\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003eedinburgh@projektride.co.uk\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003eT- 01313745324\u003c\/strong\u003e\u003c\/p\u003e\n\u003cp\u003e\u003cbr\u003e\u003c\/p\u003e\n\u003cul data-mce-fragment=\"1\"\u003e\u003c\/ul\u003
opify.com/extensions/019f37a7-f058-7bcb-a02d-3fb0b8a7522a/restockrocket-1-539/assets/restockrocket-collection-bis.js'
window._RestockRocketConfig.scriptHost = window._RestockRocketConfig.scriptUrlProduct.substring(0, window._RestockRocketConfig.scriptUrlProduct.lastIndexOf('/') + 1)
// Canary override (STOQ-1287): prefer the Render host emitted into the
// metafield-cached settings (api_host) when present, mirroring the same
// override in assets/js/api.js. cachedSettings is populated above. Falls
// back to the build-baked host for shops without the use_render_api_host
// toggle (or environments where THEME_EXTENSION_API_HOST is unset), so the
// setting.json + fetchEmbedConfig calls below route to the same host as the
// rest of the extension's API traffic instead of staying on the baked host.
window._RestockRocketConfig.host = (window._RestockRocketConfig.cachedSettings && window._RestockRocketConfig.cachedSettings.api_host) || 'https://app.restockrocket.io'
// Deployed extension build
option1":"700c \/ 25mm","option2":null,"option3":null,"sku":"4019238371390","requires_shipping":true,"taxable":true,"featured_image":null,"available":true,"name":"700c Continental Gatorskin Black Road Tyre (Folding) - 700c \/ 25mm","public_title":"700c \/ 25mm","options":["700c \/ 25mm"],"price":4495,"weight":1000,"compare_at_price":3995,"inventory_management":"shopify","barcode":null,"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":42205176496354,"title":"700c \/ 28mm","option1":"700c \/ 28mm","option2":null,"option3":null,"sku":"4019238581430","requires_shipping":true,"taxable":true,"featured_image":null,"available":true,"name":"700c Continental Gatorskin Black Road Tyre (Folding) - 700c \/ 28mm","public_title":"700c \/ 28mm","options":["700c \/ 28mm"],"price":4495,"weight":1000,"compare_at_price":3995,"inventory_management":"shopify","barcode":null,"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":
<
ariant_ids) || []).length;
_sqCfg.preordersConfigured = !!(_sqPlanEnabled && _sqPreCount);
} catch (e) { /* fail open */ }
// STOQ-1612: block (not hide) Buy Now / Shop Pay until our JS runs, so a tap in the
// load window can't bypass preorder. pointer-events via .stoq-buy-now-pending (no
// reflow); timeout releases; renderPreorderButton / featured_product.js lift it.
// Gated by the `block_accelerated_checkout` toggle (default OFF) for gradual rollout.
// Armed ONLY when we're sure preorder is in play — product page: THIS product has a
// preorder variant (never block a plain product's Shop Pay); featured: integration
// enabled for this page type. Rationale: PR #2784.
try {
var _sqc = window._RestockRocketConfig;
var _sqOn = !!(_sqc.cachedSettings && _sqc.cachedSettings.block_accelerated_checkout);
var _sqPre = (_sqc.cachedPreorderVariantIds &&
_sqc.cachedPreorderVariantIds.preorder_variant_ids) || [];
var _sqArm = false;
if (_sqOn && _sqc.preordersConfig770,46025418637538,46025419849954,46025438560482,46025438658786,46034350276834,46034406998242,46034407424226,46034418499810,46034419613922,46034424037602,46034471092450,46034766266594,46034799231202,46034809454818,46034809487586,46038086680802,46038086713570,46038086746338,46038086779106,46038086811874,46038086844642,46038086877410,46038086910178,46038086942946,46038086975714,46038087008482,46038087041250,46038087074018,46038087106786,46038087139554,46038087172322,46038087205090,46038087237858,46038087270626,46038087303394,46038087336162,46038087368930,46038087401698,46038087434466,46038087467234,46038087500002,46038087532770,46038087565538,46038087598306,46038087631074,46038087663842,46038087696610,46038087729378,46038087762146,46038087794914,46038087827682,46038087860450,46038087925986,46038087991522,46038088057058,46038088122594,46038088188130,46038088253666,46038088384738,46038088515810,46038088646882,46038088679650,46038088712418,46038088745186,46038088777954,46038088810722,46038088843490,46038088876258,
che age
if (!liquidRenderedAt || typeof liquidRenderedAt !== 'number' || isNaN(liquidRenderedAt)) {
console.debug('STOQ - Invalid or missing liquidRenderedAt timestamp, assuming fresh');
window._RestockRocketConfig.isLiquidCacheFresh = true;
window._RestockRocketConfig.liquidCacheAge = null;
} else {
const now = Math.floor(Date.now() / 1000); // Current time in seconds
const liquidCacheAge = now - liquidRenderedAt; // Age in seconds
// Surfaced into funnel events: a stale cache means the app rendered with
// outdated inventory/selling-plan data — a real "had the opportunity but
// failed" cause. Negative (client clock ahead) clamps to 0.
window._RestockRocketConfig.liquidCacheAge = Math.max(0, liquidCacheAge);
// Handle client clock ahead of server
if (liquidCacheAge
om/extensions/019f37a7-f058-7bcb-a02d-3fb0b8a7522a/restockrocket-1-539/assets/restockrocket-collection.js'
window._RestockRocketConfig.scriptUrlProductBis = 'https://cdn.shopify.com/extensions/019f37a7-f058-7bcb-a02d-3fb0b8a7522a/restockrocket-1-539/assets/restockrocket-product-bis.js'
window._RestockRocketConfig.scriptUrlCollectionBis = 'https://cdn.shopify.com/extensions/019f37a7-f058-7bcb-a02d-3fb0b8a7522a/restockrocket-1-539/assets/restockrocket-collection-bis.js'
window._RestockRocketConfig.scriptHost = window._RestockRocketConfig.scriptUrlProduct.substring(0, window._RestockRocketConfig.scriptUrlProduct.lastIndexOf('/') + 1)
// Canary override (STOQ-1287): prefer the Render host emitted into the
// metafield-cached settings (api_host) when present, mirroring the same
// override in assets/js/api.js. cachedSettings is populated above. Falls
// back to the build-baked host for shops without the use_render_api_host
// toggle (or environments where THEME_EXTENSION_API_HOST is unset), so the
6806573282,46047079465186,46047079530722,46047079661794,46047079727330,46047079792866,46047079858402,46057685909730,46057686008034,46057686171874,46057686204642,46057686630626,46057686761698,46057745645794,46057745678562,46057745776866,46066053218530,46066053578978,46066053611746,46066053742818,46066053939426,46081900839138,46081901887714,46081905656034,46081916862690,46081923907810,46081925447906,46081927971042,46081929216226,46081934819554,46081935507682,46081946353890,46081946878178,46081947009250,46081949597922,46081955627234,46081958346978,46081959428322,46081965424866,46081970438370,46081976402146,46081976926434,46081977221346,46081986986210,46081991672034,46081992294626,46081992753378,46081993179362,46081993572578,46081993867490,46082006384866,46082006876386,46082016051426,46082018967778,46082046689506,51888937337215,51888937369983,51888937402751,51888937435519,51982381121919,54900951253375,54900951286143,54901043134847,54901043167615,54901043200383,54945187430783,54945187463551,54945187496319,54945187
0) {
console.debug(`STOQ - Client clock appears ahead of server by ${Math.abs(Math.round(liquidCacheAge / 60))} minutes, assuming cache fresh`);
window._RestockRocketConfig.isLiquidCacheFresh = true;
} else if (liquidCacheAge
<11,54945293009279,54945301037439,54945301070207,54945311326591,54945311359359,54945311392127,54945311424895,54945311457663,54945311490431,54945311523199,54945337540991,54945337704831,54945337803135,54945337835903,54945337868671,54945337901439,54945337966975,54945338032511,54945338098047,54945351631231,54945351663999,54945351762303,54945351795071,54945378140543,54945378173311,54945378206079,54945378238847,54945378271615,54945378304383,54945378337151,54945380925823,54945380958591,54945380991359,54945381024127,54945381056895,54945381089663,54945381122431,54945391444351,54945391477119,54945391509887,54945395310975,54945395343743,54945395376511,54945399275903,54945399308671,54945399341439,54945399374207,54945399406975,54945399439743,54945399472511,54945399505279,54945399538047,54945399570815,54945399603583,54945399636351,54945431683455,54945431716223,54945431748991,54945431781759,54945431814527,54945431847295,54945431880063,54945433125247,54945433158015,54945436467583,54945436500351,54945436533119,54945436565887,5
= LIQUID_CACHE_MAX_AGE) {
console.debug(`STOQ - Liquid cache is fresh (${Math.round(liquidCacheAge / 60)} minutes old)`);
window._RestockRocketConfig.isLiquidCacheFresh = true;
} else {
console.debug(`STOQ - Liquid cache is stale (${Math.round(liquidCacheAge / 60)} minutes old, max ${Math.round(LIQUID_CACHE_MAX_AGE / 60)} minutes)`);
window._RestockRocketConfig.isLiquidCacheFresh = false;
}
}
function checkSettingsExpiry(settings) {
try {
if (!settings || !settings.updated_at) {
console.debug('STOQ - Invalid settings data structure');
return null;
}
if (!settings.cache) {
console.debug('STOQ - settings caching disabled');
return null;
}
// Check if translations are enabled but missing from cache
// This handles the backfill period where DB has translations but metafield doesn't
if (settings.multi_language_enabled) {
if (!settings.translations) {
// Translations enabled but no
<520189823,54945520222591,54945520255359,54945520288127,54945520320895,54945520353663,54945520386431,54945520419199,54945520451967,54945523532159,54945546764671,54945546797439,54945546830207,54945546928511,54945546961279,54945548042623,54945548075391,54945548108159,54945548140927,54945548173695,54945548206463,54945548239231,54945548271999,54945550336383,54945550369151,54945550401919,54945550434687,54945550467455,54945550500223,55038016422271,55196401860991,55196401893759,55196401926527,55196402647423,55196403433855,55196403466623,55196403532159,55196403564927,55196403630463,55196403663231,55196403695999,55196403728767,55196403794303,55196403827071,55196403859839,55196403892607,55196404285823,55196404318591,55196404351359,55196404384127,55196404416895,55196404449663,55196404482431,55196404515199,55196404547967,55196404580735,55196404613503,55196404646271,55196405662079,55196405694847,55196405727615,55196405760383,55196405825919,55196405858687,55196405891455,55196405924223,55196408185215,55196408217983,551964082
age = Date.now() - updatedAt.getTime();
if (age
Close<7,55239704215935,55239704281471,55239704314239,55239704347007,55239714374015,55239714505087,55239726596479,55245591871871,55245591970175,55245592002943,55245656818047,55245656949119,55245730152831,55245730218367,55245730316671,55245730349439,55245730382207,55245730447743,55245730578815,55245730742655,55245730775423,55245737492863,55245737623935,55245737656703,55245737689471,55245737722239,55294444142975,55294475927935,55294475960703,55294527504767,55294527537535,55294528946559,55294528979327,55333372789119,55333372821887,55333372854655,55333372887423,55333372920191,55333372952959,55333372985727,55333373018495,55333373051263,55333373084031,55333373116799,55333373182335,55333373215103,55333373280639,55333373313407,55333439340927,55333439373695,55333439406463,55333439439231,55333439471999,55333439504767,55333439537535,55333439570303,55333439603071,55333439635839,55333439668607,55333439701375,55333439734143,55333439766911,55333439832447,55333439865215,55333439897983,55333439930751,55333439963519,55333439996287,55
< SETTINGS_CACHE_DURATION) {
console.debug('STOQ - settings changed recently, skipping cache');
return null;
}
return settings;
} catch (error) {
console.debug('STOQ - Error checking settings cache:', error);
return null;
}
}
function createRestockRocketContainer() {
const restockRocketContainer = document.createElement('div');
restockRocketContainer.id = 'restock-rocket';
document.body.appendChild(restockRocketContainer);
}
function createRestockRocketScript(scriptUrl) {
const restockRocketScriptElement = document.createElement('script');
restockRocketScriptElement.setAttribute('defer', 'defer');
restockRocketScriptElement.src = scriptUrl;
document.body.appendChild(restockRocketScriptElement);
}
createRestockRocketContainer()
console.debug('STOQ - extension activated')
// Fire stoq_initialized once per page load so the funnel pipeline has a definitive
// "our code ran on this page" signal independent of any cus
che age
if (!liquidRenderedAt || typeof liquidRenderedAt !== 'number' || isNaN(liquidRenderedAt)) {
console.debug('STOQ - Invalid or missing liquidRenderedAt timestamp, assuming fresh');
window._RestockRocketConfig.isLiquidCacheFresh = true;
window._RestockRocketConfig.liquidCacheAge = null;
} else {
const now = Math.floor(Date.now() / 1000); // Current time in seconds
const liquidCacheAge = now - liquidRenderedAt; // Age in seconds
// Surfaced into funnel events: a stale cache means the app rendered with
// outdated inventory/selling-plan data — a real "had the opportunity but
// failed" cause. Negative (client clock ahead) clamps to 0.
window._RestockRocketConfig.liquidCacheAge = Math.max(0, liquidCacheAge);
// Handle client clock ahead of server
if (liquidCacheAge 89741439,55482589774207,55482589806975,55482603536767,55482603569535,55482603602303,55482603635071,55482603667839,55482603700607,55482623361407,55482623394175,55482623426943,55482623459711,55482623492479,55482639122815,55482639155583,55482639188351,55482639221119,55482666844543,55482671497599,55482671530367,55482671563135,55482671595903,55482671628671,55482675102079,55482675134847,55482675167615,55482675626367,55482675659135,55482675691903,55482677952895,55482679787903,55482684965247,55553117356415,55553117389183,55553117454719,55553117487487,55553117520255,55553117553023,55553117585791,55570017517951,55585620263295,55585620296063,55585620328831,55585620361599,55664837296511,55664857874815,55664857907583,55664857940351,55664857973119,55664858005887,56051529482623,56051529515391,56051529548159,56051529580927,56051529613695,56063296373119,56063296405887,56063296438655,56063296471423,56063370428799,56063370461567,56063370494335,56063370527103,56063691129215,56140121801087,56140121833855,56140121899391,5614012193
tomer interaction.
// Detected variants: the variants present in this page's Liquid context (product page has them;
// collection/index/etc. don't expose variants from Liquid). Used to disambiguate "embed didn't
// load" vs "embed loaded but the variant wasn't a preorder/BIS candidate" in order debug.
try {
const _stoqInitConfig = window._RestockRocketConfig;
const _stoqDetectedVariantIds = (_stoqInitConfig.product && Array.isArray(_stoqInitConfig.product.variants))
? _stoqInitConfig.product.variants.map(function(v) { return v.id })
: [];
const _stoqSelectedVariantId = _stoqInitConfig.selected_variant_id;
Shopify?.analytics?.publish?.('stoq_initialized', {
cart_token: _stoqInitConfig.cartToken || '',
page_url: window.location.href,
page_type: _stoqInitConfig.pageType || '',
shop_domain: _stoqInitConfig.shop || '',
market_id: _stoqInitConfig.marketId || '',
detected_variant_ids: _stoqDetectedVariantIds,
selected_variant_id: _stoqSele
ctedVariantId || '',
liquid_rendered_at: _stoqInitConfig.liquidRenderedAt || 0,
app_version: _stoqInitConfig.appVersion || '',
liquid_cache_age: _stoqInitConfig.liquidCacheAge,
// Selected variant's stock posture as our app saw it at render — explains
// whether we *should* have treated it as a preorder candidate.
inventory_policy: (_stoqInitConfig.variantsInventoryPolicy || {})[_stoqSelectedVariantId] || '',
inventory_quantity: (_stoqInitConfig.variantsInventoryQuantity || {})[_stoqSelectedVariantId],
});
} catch (e) {
console.debug('STOQ - stoq_initialized publish failed:', e);
}
// STOQ-1595: publish stoq_accelerated_checkout_clicked for every accelerated-checkout
// click (Buy Now / dynamic checkout / Shop Pay installments) on ALL surfaces, before our
// bundle loads, via one delegated capture-phase listener (catches late-rendered buttons).
// Only on shops with preorders configured (shared `preordersConfigured` signal from the
// derivati
0) {
console.debug(`STOQ - Client clock appears ahead of server by ${Math.abs(Math.round(liquidCacheAge / 60))} minutes, assuming cache fresh`);
window._RestockRocketConfig.isLiquidCacheFresh = true;
} else if (liquidCacheAge ,56385205862783,56385205928319,56386096628095,56386096726399,56386096824703,56386096923007,56386096955775,56386097021311,56386097119615,56386097217919,56386097250687,56386097283455,56386097316223,56386097348991,56386097381759,56386097414527,56386097447295,56386097480063,56386097512831,56386097545599,56386097578367,56386097611135,56386097643903,56386097807743,56386097840511,56386097873279,56386097938815,56386098626943,56386098659711,56386098758015,56386098790783,56386098823551,56386098856319,56386098921855,56386098954623,56386099020159,56386099609983,56386099675519,56386099872127,56386100527487,56386100593023,56386100658559,56386101084543,56386101117311,56386101150079,56393228648831,56393228812671,56393231630719,56393231761791,56393231991167,56393232155007,56393232220543,56393232384383,56393232449919,56393232580991,56393232777599,56393232875903,56393232974207,56393233236351,56393233367423,56393233629567,56393233760639,56393234088319,56393234252159,56393234350463,56393234481535,56393234678143,56393235759487,563
on block above) — nothing to bypass otherwise. variant_id is read per-clicked-button
// from its form so it's correct on collection/index/search too. block_accelerated_checkout
// context (STOQ-1612) rides in `properties` (forwarded verbatim by the pixel, no schema
// change): a buy_now click on a preorder variant while the gate was armed is a visible
// bypass signal for order debug. Also sends page_url (top-level, like the pixel's native
// events) and two preorder signals in properties (see below).
try {
var _sqTrack = window._RestockRocketConfig;
if (_sqTrack.preordersConfigured) {
document.addEventListener('click', function (e) {
try {
var t = e.target;
if (!t || !t.closest) return;
var host = t.closest('.shopify-payment-button, shopify-payment-terms');
if (!host) return;
var channel = host.matches && host.matches('shopify-payment-terms')
? 'shop_pay_installments' : 'buy_now';
var form = host.close
st('form');
var vidEl = form && form.querySelector('[name="id"]');
var variantId = (vidEl && vidEl.value) || _sqTrack.selected_variant_id || '';
// The enabled STOQ selling plan the clicked variant belongs to (if any), found once and
// reused for in_enabled_plan / enrolled_plan_id / enrolled_plan_provider below.
var _sqVidNum = Number(variantId);
var _sqPlan = null;
// Array.isArray guard (not `|| []`) so a truthy non-array sellingPlans can't throw and
// silently drop the whole publish.
var _sqPlans = Array.isArray(_sqTrack.sellingPlans) ? _sqTrack.sellingPlans : [];
_sqPlans.forEach(function (pl) {
if (!_sqPlan && pl && pl.enabled && Array.isArray(pl.variant_ids) &&
pl.variant_ids.indexOf(_sqVidNum) !== -1) { _sqPlan = pl; }
});
Shopify?.analytics?.publish?.('stoq_accelerated_checkout_clicked', {
variant_id: variantId,
product_id: (_sqTr
= LIQUID_CACHE_MAX_AGE) {
console.debug(`STOQ - Liquid cache is fresh (${Math.round(liquidCacheAge / 60)} minutes old)`);
window._RestockRocketConfig.isLiquidCacheFresh = true;
} else {
console.debug(`STOQ - Liquid cache is stale (${Math.round(liquidCacheAge / 60)} minutes old, max ${Math.round(LIQUID_CACHE_MAX_AGE / 60)} minutes)`);
window._RestockRocketConfig.isLiquidCacheFresh = false;
}
}
function checkSettingsExpiry(settings) {
try {
if (!settings || !settings.updated_at) {
console.debug('STOQ - Invalid settings data structure');
return null;
}
if (!settings.cache) {
console.debug('STOQ - settings caching disabled');
return null;
}
// Check if translations are enabled but missing from cache
// This handles the backfill period where DB has translations but metafield doesn't
if (settings.multi_language_enabled) {
if (!settings.translations) {
// Translations enabled but no 6685055,56494086717823,56494086783359,56494086914431,56494086947199,56494086979967,56494087045503,56494087078271,56494087111039,56494087143807,56494087176575,56494087209343,56494087242111,56494087274879,56494087307647,56494087340415,56494087373183,56494087405951,56494087504255,56494087537023,56494087799167,56494088356223,56494088454527,56494090289535,56504701485439,56504701518207,56504701550975,56504701583743,56504701616511,56504701649279,56504839209343,56504839242111,56504839274879,56504839307647,56504839340415,56504839373183,56504921981311,56504922014079,56504922046847,56504922079615,56504922112383,56504922145151,56504922177919,56504922210687,56504922243455,56504950489471,56504950522239,56504950555007,56504950587775,56504950620543,56504950653311,56504950686079,56504950718847,56504950751615,56504961139071,56504961171839,56504961204607,56504961237375,56504961270143,56504961302911,56504961335679,56504961368447,56504961401215,56505064489343,56505064522111,56505064554879,56505064587647,56505064620415,56505064653
ack.product && _sqTrack.product.id) || '',
channel: channel,
market_id: _sqTrack.marketId || '',
page_type: _sqTrack.pageType || '',
cart_token: _sqTrack.cartToken || '',
page_url: (window.location && window.location.href) || '',
properties: {
// Mirror the bundle's own preorder check (preorder.js checkInventoryProvider-
// WithCachedFallback): the live set config.preorderVariantIds (refreshed after
// page load by loadVariantInventoryData) OR the Liquid-injected
// cachedPreorderVariantIds — always present, so it covers clicks before the
// bundle loads (why this tracker is inline). ORing both (not preferring one)
// matches the bundle and is correct even if the live set is an empty array. Both
// hold integer ids; the click-time id comes off a DOM input (.value → string) or
// selected_variant_id, so coerce with Number for
a like-typed compare.
is_preorder_variant: (function () {
var vid = Number(variantId);
var has = function (a) { return Array.isArray(a) && a.indexOf(vid) !== -1; };
return has(_sqTrack.preorderVariantIds) ||
has(_sqTrack.cachedPreorderVariantIds &&
_sqTrack.cachedPreorderVariantIds.preorder_variant_ids);
})(),
// Narrow, authoritative preorder signal: enrolled in an ENABLED STOQ selling plan
// (is_preorder_variant above is the broad OOS+continue heuristic — non-STOQ too).
in_enabled_plan: !!_sqPlan,
// In-stock preorder signal: enrolled but currently IN STOCK (in the inStockVariantIds
// set, not the OOS preorderVariantIds set). Same live-OR-cached pattern as
// is_preorder_variant. is_preorder_variant OR is_instock_variant = "should sell via
// the plan" regardless of stock, so an in-stock preord
age = Date.now() - updatedAt.getTime();
if (age 56518790676863,56518805651839,56518805684607,56518805717375,56518805750143,56518805782911,56561153933695,56766086054271,56766086185343,56766086250879,56766086381951,56766086447487,56766086513023,56766086840703,56766183342463,56766183375231,56766183407999,56766183440767,56766183473535,56766183506303,56766183539071,56766183571839,56766183637375,56766183670143,56766183768447,56766183801215,56766183833983,56766183932287,56766183965055,56766183997823,56766184030591,56766184096127,56766184128895,56766184161663,57284689789311,57284689822079,57284689854847,57284689887615,57284689920383,57284689953151,57284689985919,57284690018687,57284690051455,57284690084223,57284690116991,57284690149759,57284690182527,57284690215295,57284690248063,57284690313599,57284690346367,57284690379135,57284690411903,57311934513535,57311934546303,57311934579071,57311934611839,57318991724927,57318991790463,57318991823231,57319008797055,57319008829823,57319008862591,57319008895359,57392715465087,57392715497855,57392715530623,57392715563391,5739
er bypass is detectable too.
is_instock_variant: (function () {
var has = function (a) { return Array.isArray(a) && a.indexOf(_sqVidNum) !== -1; };
return has(_sqTrack.inStockVariantIds) ||
has(_sqTrack.cachedInStockVariantIds &&
_sqTrack.cachedInStockVariantIds.in_stock_variant_ids);
})(),
// The enrolled plan's Shopify selling-plan id + inventory_provider (stoq = STOQ tracks
// the OOS count; shopify = in-stock preorder). Tells order-debug what kind of preorder
// the Buy Now bypassed, without a downstream lookup.
enrolled_plan_id: (_sqPlan && (_sqPlan.shopify_selling_plan_id || _sqPlan.shopify_selling_plan_group_id)) || '',
enrolled_plan_provider: (_sqPlan && _sqPlan.inventory_provider) || '',
block_enabled: !!(_sqTrack.cachedSettings && _sqTrack.cachedSettings.block_accelerated_checkout),
gate_armed: !!_sqTrack.acceleratedGateArmed,
gate_active_at_click: !!(document.documentElement &&
document.documentElement.classList.contains('stoq-buy-now-pending')),
},
});
} catch (err) { /* never break checkout */ }
}, true);
}
} catch (e) { /* fail open */ }
function applyTranslations(settings) {
try {
// Skip translation logic entirely if multi-language is not enabled
if (!settings || !settings.multi_language_enabled) {
return settings;
}
if (!settings.translations) {
console.debug('STOQ - No translations found, skipping translation');
return settings;
}
const normalizedLocale = window._RestockRocketConfig.normalizedLocale;
const translations = settings.translations;
if (!normalizedLocale) {
// No matching locale has translations; drop payload to save memory
console.debug('STOQ - No matching locale for translations. Available:', Object.keys(translations || {})
SETTINGS_CACHE_DURATION) {
console.debug('STOQ - settings changed recently, skipping cache');
return null;
}
return settings;
} catch (error) {
console.debug('STOQ - Error checking settings cache:', error);
return null;
}
}
function createRestockRocketContainer() {
const restockRocketContainer = document.createElement('div');
restockRocketContainer.id = 'restock-rocket';
document.body.appendChild(restockRocketContainer);
}
function createRestockRocketScript(scriptUrl) {
const restockRocketScriptElement = document.createElement('script');
restockRocketScriptElement.setAttribute('defer', 'defer');
restockRocketScriptElement.src = scriptUrl;
document.body.appendChild(restockRocketScriptElement);
}
createRestockRocketContainer()
console.debug('STOQ - extension activated')
// Fire stoq_initialized once per page load so the funnel pipeline has a definitive
// "our code ran on this page" signal independent of any cus793983,57596176859519,57596176925055,57596177056127,57596177088895,57596177121663,57596177252735,57596177285503,57596177351039,57596177383807,57596177416575,57596177449343,57596177514879,57596177547647,57596177613183,57596177645951,57596177809791,57596177842559,57596177875327,57596177908095,57602995126655,57602995159423,57602995192191,57602995224959,57602995257727,57602995290495,57602995323263,57602995356031,57602995388799,57602995421567,57602995454335,57602995487103,57602995519871,57602995552639,57602995585407,57602995618175,57602995650943,57602995683711,57602995716479,57602995749247,57602995782015,57602995814783,57602995847551,57602995880319,57602995913087,57602995945855,57602995978623,57602996011391,57602996044159,57602996076927,57602996109695,57602996142463,57602996175231,57602996207999,57602996240767,57602996273535,57602996306303,57602996339071,57602996371839,57602996404607,57602996437375,57602996470143,57602996502911,57602996535679,57602996568447,57602996601215,57602996633983,57602996666751,576029966995
);
delete settings.translations;
return settings;
}
console.debug(`STOQ - Applying translations for normalized locale: ${normalizedLocale} (original: ${window._RestockRocketConfig.locale})`);
const translatedFields = translations[normalizedLocale];
if (translatedFields && typeof translatedFields === 'object') {
Object.keys(translatedFields).forEach(function(key) {
const value = translatedFields[key];
if (value !== null && value !== undefined && value !== '') {
settings[key] = value;
}
});
} else {
console.debug('STOQ - No translated fields found for locale:', normalizedLocale);
}
delete settings.translations;
return settings;
} catch (e) {
console.debug('STOQ - error applying translations:', e);
return settings;
}
}
// Setup event listener for cart selling plan updates
// This must be called before any scripts are loaded to avoid race conditions
func
's native
// events) and two preorder signals in properties (see below).
try {
var _sqTrack = window._RestockRocketConfig;
if (_sqTrack.preordersConfigured) {
document.addEventListener('click', function (e) {
try {
var t = e.target;
if (!t || !t.closest) return;
var host = t.closest('.shopify-payment-button, shopify-payment-terms');
if (!host) return;
var channel = host.matches && host.matches('shopify-payment-terms')
? 'shop_pay_installments' : 'buy_now';
var form = host.closest('form');
var vidEl = form && form.querySelector('[name="id"]');
var variantId = (vidEl && vidEl.value) || _sqTrack.selected_variant_id || '';
// The enabled STOQ selling plan the clicked variant belongs to (if any), found once and
// reused for in_enabled_plan / enrolled_plan_id / enrolled_plan_provider below.
var _sqVidNum = Number(variantId);
var _sqPlan = null;
// A
): the live set config.preorderVariantIds (refreshed after
// page load by loadVariantInventoryData) OR the Liquid-injected
// cachedPreorderVariantIds — always present, so it covers clicks before the
// bundle loads (why this tracker is inline). ORing both (not preferring one)
// matches the bundle and is correct even if the live set is an empty array. Both
// hold integer ids; the click-time id comes off a DOM input (.value → string) or
// selected_variant_id, so coerce with Number for a like-typed compare.
is_preorder_variant: (function () {
var vid = Number(variantId);
var has = function (a) { return Array.isArray(a) && a.indexOf(vid) !== -1; };
return has(_sqTrack.preorderVariantIds) ||
has(_sqTrack.cachedPreorderVariantIds &&
_sqTrack.cachedPreorderVariantIds.preorder_variant_ids);
})(),
//
lan id + inventory_provider (stoq = STOQ tracks
// the OOS count; shopify = in-stock preorder). Tells order-debug what kind of preorder
// the Buy Now bypassed, without a downstream lookup.
enrolled_plan_id: (_sqPlan && (_sqPlan.shopify_selling_plan_id || _sqPlan.shopify_selling_plan_group_id)) || '',
enrolled_plan_provider: (_sqPlan && _sqPlan.inventory_provider) || '',
block_enabled: !!(_sqTrack.cachedSettings && _sqTrack.cachedSettings.block_accelerated_checkout),
gate_armed: !!_sqTrack.acceleratedGateArmed,
gate_active_at_click: !!(document.documentElement &&
document.documentElement.classList.contains('stoq-buy-now-pending')),
},
});
} catch (err) { /* never break checkout */ }
}, true);
}
} catch (e) { /* fail open */ }
function applyTranslations(settings) {
try {
// Skip translation logic entirely if multi-language is not enabled
nslatedFields[key];
if (value !== null && value !== undefined && value !== '') {
settings[key] = value;
}
});
} else {
console.debug('STOQ - No translated fields found for locale:', normalizedLocale);
}
delete settings.translations;
return settings;
} catch (e) {
console.debug('STOQ - error applying translations:', e);
return settings;
}
}
// Setup event listener for cart selling plan updates
// This must be called before any scripts are loaded to avoid race conditions
function setupCartSellingPlanUpdater(settings) {
// Setup listener regardless - updateCartSellingPlans has its own guards
// This ensures cleanup happens even when preorders are disabled globally
// Listen for stoq:inventory-data-loaded event dispatched by api.js
window.addEventListener('stoq:inventory-data-loaded', function(event) {
console.debug('STOQ - Inventory data loaded, updating cart selling plans');
if (wind<
"settings") { value } } }';
fetch(
`https://${cfg.shop}/api/2025-07/graphql.json`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Shopify-Storefront-Access-Token': cfg.storefrontAccessToken,
},
body: JSON.stringify({ query: query, variables: { namespace: cfg.metafieldNamespace } }),
}
)
.then(function(response) {
if (!response.ok) { throw new Error('Storefront API HTTP ' + response.status); }
return response.json();
})
.then(function(body) {
if (body && body.errors && body.errors.length) {
throw new Error('Storefront API errors: ' + body.errors.map(function(e) { return e && e.message; }).join(', '));
}
const value = body && body.data && body.data.shop && body.data.shop.metafield && body.data.shop.metafield.value;
if (!value) { throw new Error('Storefront API returned no settings metafield value'); }
cfg.stop'
};
if (window.Shopify?.theme?.role === 'main') {
headers['X-Shopify-Theme-Schema-Name'] = window.Shopify.theme.schema_name;
headers['X-Shopify-Theme-Schema-Version'] = window.Shopify.theme.schema_version;
headers['X-Shopify-Theme-Store-Id'] = window.Shopify.theme.theme_store_id;
}
fetch(
`${window._RestockRocketConfig.host}/api/v1/setting.json?translation_locale=${window._RestockRocketConfig.normalizedLocale}`,
{ headers }
)
.then(function(response) {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(function(settings) {
initializeScripts(settings);
})
.catch(function(error) {
// If request failed and we have cached settings (even if expired), use them as fallback
if (cachedSettings) {
console.debug('STOQ - using expired cached settings as fallback');
initializeScripts(cachedSettings);
} else {
console.error('S endpoint + ':', applyError);
throw applyError;
}
})
.catch(function(error) {
console.debug(`STOQ - using cached ${endpoint}:`, error.message);
});
}
function initializeScripts(settings) {
settings = applyTranslations(settings);
window._RestockRocketConfig.settings = settings;
console.debug(`STOQ - settings configured for ${window._RestockRocketConfig.pageType}`);
// Stale-Liquid resilience (default-on, per-shop opt-out via the
// `disable_refresh_on_stale_liquid` Toggle, surfaced as the negative
// `disable_refresh_on_stale_liquid` flag in settings.json so that
// `undefined` -- in CDN-cached metafield payloads that predate this
// key -- reads as `!undefined === true` and gets default-on behavior
// immediately, no metafield rewrite required).
// When the Liquid CDN cache is older than LIQUID_CACHE_MAX_AGE the in-page
// selling_plans / integrations metafields can be wrong; refresh both from
// the API before launching scr }
}),
fetchEmbedConfig('integrations', function(data) {
if (Array.isArray(data)) {
window._RestockRocketConfig.integrations = data;
}
})
]),
new Promise(function(resolve) { setTimeout(resolve, 1000); })
]).then(function() { loadScripts(settings); });
return;
}
loadScripts(settings);
}
function loadScripts(settings) {
// Setup cart selling plan updater BEFORE loading any scripts to avoid race conditions
setupCartSellingPlanUpdater(settings);
if(settings.enable_app) {
const hijackIntegration = window._RestockRocketConfig.integrations.find(function(integration) {
return integration.type === 'hijack' && integration.enabled && integration.page_types.includes(window._RestockRocketConfig.pageType);
})
// STOQ-1520: serve the lean back-in-stock-only build (no preorder/hijack code)
// only to shops with NO preorder plans. Use the full build if preorder is o
onPageTypes = ['collection', 'index', 'search', 'page'];
if(collectionPageTypes.indexOf(pageType) !== -1 && (settings[`show_button_on_${pageType}`] || settings[`preorder_${pageType}_enabled`])) {
createRestockRocketScript(collectionScriptUrl);
} else if(pageType === 'product') {
createRestockRocketScript(productScriptUrl);
} else if(hijackIntegration) {
createRestockRocketScript(window._RestockRocketConfig.scriptUrlCollection);
} else if(usePreorderBuild) {
// cart/article/blog/list-collections: full build so the cart sweep runs.
createRestockRocketScript(window._RestockRocketConfig.scriptUrlCollection);
} else {
console.debug(`STOQ - no scripts enabled for ${pageType}`);
}
// Dispatch custom event when app is loaded
// Cart selling plan updates will be triggered by stoq:inventory-data-loaded event
const appLoadedEvent = new CustomEvent('stoq:loaded', {
detail: {
pageType: window._RestockR
r_acknowledgement_text":"I acknowledge and agree to the preorder terms and conditions for this product.","disable_button_until_acknowledged":false,"preorder_min_quantity":null,"preorder_max_quantity":null,"countdown_timer_enabled":false,"countdown_timer_style":"text","countdown_timer_text_color":"#000000","countdown_timer_background_color":"#f5f5f5","countdown_timer_border_radius":8,"countdown_timer_format":"DHMS","countdown_timer_use_schedule_dates":true,"countdown_timer_custom_start_date":null,"countdown_timer_custom_end_date":null,"countdown_timer_starts_text":null,"countdown_timer_ends_text":null,"schedule_offer":false,"schedule_start_date":null,"schedule_end_date":null,"updated_at":"2025-08-19T10:05:43.042Z","allow_mixed_cart":true,"mixed_cart_error_message":"Preorders must be purchased separately from regular items. Please complete your current order first, or clear your cart to continue.","b2b_enabled":true,"preorder_progress_bar_enabled":false,"preorder_progress_bar_text":"{{ sold }} of {{ total }} cl
ble for preorder","preorder_button_description_shipping_text_prefix":"Shipping: ","delivery_exact_time":null,"delivery_after_n_intervals":null,"delivery_at":"2025-07-26T09:20:18.169Z","delivery_type":"asap","quantity_limit_text":"{{ quantity }} units available for preorder","preorder_button_description_show_shipping":true,"preorder_button_description_icons_enabled":true,"preorder_shipping_text":"Shipping: {{ date }}","shipping_applies_to_all_products":true,"shipping_text":"Estimated to ship within 2 months","payment_type":"full","billing_checkout_charge_type":"percentage","billing_checkout_charge_amount":null,"billing_checkout_charge_percentage":"100.0","pricing_type":"no_discount","pricing_amount":null,"pricing_percentage":null,"discount_text":"Save {{ discount }}","billing_title":"Full payment","billing_description":null,"enable_billing_widget":false,"inventory_provider":"stoq","preorder_badge_enabled":false,"preorder_badge_text":"Preorder","preorder_badge_text_color":"#FFFFFF","preorder_badge_background_co
_preorder_acknowledgement":false,"preorder_acknowledgement_text":"I acknowledge and agree to the preorder terms and conditions for this product.","disable_button_until_acknowledged":false,"preorder_min_quantity":null,"preorder_max_quantity":null,"countdown_timer_enabled":false,"countdown_timer_style":"text","countdown_timer_text_color":"#000000","countdown_timer_background_color":"#f5f5f5","countdown_timer_border_radius":8,"countdown_timer_format":"DHMS","countdown_timer_use_schedule_dates":true,"countdown_timer_custom_start_date":null,"countdown_timer_custom_end_date":null,"countdown_timer_starts_text":null,"countdown_timer_ends_text":null,"schedule_offer":false,"schedule_start_date":null,"schedule_end_date":null,"updated_at":"2025-08-19T10:05:43.042Z","allow_mixed_cart":true,"mixed_cart_error_message":"Preorders must be purchased separately from regular items. Please complete your current order first, or clear your cart to continue.","b2b_enabled":true,"preorder_progress_bar_enabled":false,"preorder_progres
lanDate > maxDate)) ? plan.updated_at : max;
}
return max;
}, '')
: null;
// Use cached if old array is empty/has no timestamps, or cached is newer
// Parse dates for comparison to handle format differences (+00:00 vs .000Z)
const cachedDate = new Date(cachedData.cached_at);
const maxDate = maxUpdatedAt ? new Date(maxUpdatedAt) : null;
const useCached = !maxUpdatedAt || (cachedDate && !isNaN(cachedDate) && (!maxDate || cachedDate > maxDate));
if (useCached) {
if (Array.isArray(cachedData.plans)) {
window._RestockRocketConfig.sellingPlans = cachedData.plans;
// Only use disabled_plan_ids when using cached plans
window._RestockRocketConfig.disabledSellingPlanIds = cachedData.disabled_plan_ids || [];
console.debug('[RR] Using selling plans from cachedSellingPlans (cached_at: ' + cachedData.cached_at + ')');
}
} else {
// When usi SETTINGS_CACHE_DURATION) {
console.debug('STOQ - settings changed recently, skipping cache');
return null;
}
return settings;
} catch (error) {
console.debug('STOQ - Error checking settings cache:', error);
return null;
}
}
function createRestockRocketContainer() {
const restockRocketContainer = document.createElement('div');
restockRocketContainer.id = 'restock-rocket';
document.body.appendChild(restockRocketContainer);
}
function createRestockRocketScript(scriptUrl) {
const restockRocketScriptElement = document.createElement('script');
restockRocketScriptElement.setAttribute('defer', 'defer');
restockRocketScriptElement.src = scriptUrl;
document.body.appendChild(restockRocketScriptElement);
}
createRestockRocketContainer()
console.debug('STOQ - extension activated')
// Fire stoq_initialized once per page load so the funnel pipeline has a definitive
// "our code ran on this page" signal independent of any cusrenders even though the first
// paint may use the Liquid-cached values. On any failure the existing
// Liquid-loaded values stay in place via fetchEmbedConfig's catch.
if (!window._RestockRocketConfig.isLiquidCacheFresh && !settings.disable_refresh_on_stale_liquid) {
console.debug('STOQ - Liquid cache stale, refreshing selling_plans + integrations');
Promise.race([
Promise.all([
fetchEmbedConfig('selling_plans', function(data) {
if (data && Array.isArray(data.plans)) {
window._RestockRocketConfig.sellingPlans = data.plans;
window._RestockRocketConfig.disabledSellingPlanIds = data.disabled_plan_ids || [];
}
}),
fetchEmbedConfig('integrations', function(data) {
if (Array.isArray(data)) {
window._RestockRocketConfig.integrations = data;
}
})
]),
new Promise(function(resolve) { setTimeout(resolve, 1000); })
]).then(function() { loa
tomer interaction.
// Detected variants: the variants present in this page's Liquid context (product page has them;
// collection/index/etc. don't expose variants from Liquid). Used to disambiguate "embed didn't
// load" vs "embed loaded but the variant wasn't a preorder/BIS candidate" in order debug.
try {
const _stoqInitConfig = window._RestockRocketConfig;
const _stoqDetectedVariantIds = (_stoqInitConfig.product && Array.isArray(_stoqInitConfig.product.variants))
? _stoqInitConfig.product.variants.map(function(v) { return v.id })
: [];
const _stoqSelectedVariantId = _stoqInitConfig.selected_variant_id;
Shopify?.analytics?.publish?.('stoq_initialized', {
cart_token: _stoqInitConfig.cartToken || '',
page_url: window.location.href,
page_type: _stoqInitConfig.pageType || '',
shop_domain: _stoqInitConfig.shop || '',
market_id: _stoqInitConfig.marketId || '',
detected_variant_ids: _stoqDetectedVariantIds,
selected_variant_id: _stoqSeledScripts(settings); });
return;
}
loadScripts(settings);
}
function loadScripts(settings) {
// Setup cart selling plan updater BEFORE loading any scripts to avoid race conditions
setupCartSellingPlanUpdater(settings);
if(settings.enable_app) {
const hijackIntegration = window._RestockRocketConfig.integrations.find(function(integration) {
return integration.type === 'hijack' && integration.enabled && integration.page_types.includes(window._RestockRocketConfig.pageType);
})
// STOQ-1520: serve the lean back-in-stock-only build (no preorder/hijack code)
// only to shops with NO preorder plans. Use the full build if preorder is on,
// an enabled offer exists, or a disabled-but-kept plan id remains (cart sweep
// must still strip those). Rationale in the PR.
const hasEnabledOffer = Array.isArray(window._RestockRocketConfig.sellingPlans)
&& window._RestockRocketConfig.sellingPlans.some(function(plan) { return plan && plan.enctedVariantId || '',
liquid_rendered_at: _stoqInitConfig.liquidRenderedAt || 0,
app_version: _stoqInitConfig.appVersion || '',
liquid_cache_age: _stoqInitConfig.liquidCacheAge,
// Selected variant's stock posture as our app saw it at render — explains
// whether we *should* have treated it as a preorder candidate.
inventory_policy: (_stoqInitConfig.variantsInventoryPolicy || {})[_stoqSelectedVariantId] || '',
inventory_quantity: (_stoqInitConfig.variantsInventoryQuantity || {})[_stoqSelectedVariantId],
});
} catch (e) {
console.debug('STOQ - stoq_initialized publish failed:', e);
}
// STOQ-1595: publish stoq_accelerated_checkout_clicked for every accelerated-checkout
// click (Buy Now / dynamic checkout / Shop Pay installments) on ALL surfaces, before our
// bundle loads, via one delegated capture-phase listener (catches late-rendered buttons).
// Only on shops with preorders configured (shared `preordersConfigured` signal from the
// derivatiabled; });
const hasDisabledPlanIds = Array.isArray(window._RestockRocketConfig.disabledSellingPlanIds)
&& window._RestockRocketConfig.disabledSellingPlanIds.length > 0;
const usePreorderBuild = settings.preorder_enabled || hasEnabledOffer || hasDisabledPlanIds;
const collectionScriptUrl = usePreorderBuild
? window._RestockRocketConfig.scriptUrlCollection
: window._RestockRocketConfig.scriptUrlCollectionBis;
const productScriptUrl = usePreorderBuild
? window._RestockRocketConfig.scriptUrlProduct
: window._RestockRocketConfig.scriptUrlProductBis;
const pageType = window._RestockRocketConfig.pageType;
const collectionPageTypes = ['collection', 'index', 'search', 'page'];
if(collectionPageTypes.indexOf(pageType) !== -1 && (settings[`show_button_on_${pageType}`] || settings[`preorder_${pageType}_enabled`])) {
createRestockRocketScript(collectionScriptUrl);
} else if(pageType === 'product') {
createRestockRocon block above) — nothing to bypass otherwise. variant_id is read per-clicked-button
// from its form so it's correct on collection/index/search too. block_accelerated_checkout
// context (STOQ-1612) rides in `properties` (forwarded verbatim by the pixel, no schema
// change): a buy_now click on a preorder variant while the gate was armed is a visible
// bypass signal for order debug. Also sends page_url (top-level, like the pixel's native
// events) and two preorder signals in properties (see below).
try {
var _sqTrack = window._RestockRocketConfig;
if (_sqTrack.preordersConfigured) {
document.addEventListener('click', function (e) {
try {
var t = e.target;
if (!t || !t.closest) return;
var host = t.closest('.shopify-payment-button, shopify-payment-terms');
if (!host) return;
var channel = host.matches && host.matches('shopify-payment-terms')
? 'shop_pay_installments' : 'buy_now';
var form = host.close
ketScript(productScriptUrl);
} else if(hijackIntegration) {
createRestockRocketScript(window._RestockRocketConfig.scriptUrlCollection);
} else if(usePreorderBuild) {
// cart/article/blog/list-collections: full build so the cart sweep runs.
createRestockRocketScript(window._RestockRocketConfig.scriptUrlCollection);
} else {
console.debug(`STOQ - no scripts enabled for ${pageType}`);
}
// Dispatch custom event when app is loaded
// Cart selling plan updates will be triggered by stoq:inventory-data-loaded event
const appLoadedEvent = new CustomEvent('stoq:loaded', {
detail: {
pageType: window._RestockRocketConfig.pageType,
enabled: settings.enable_app,
settings: settings,
preorderEnabled: settings.preorder_enabled
}
});
console.debug('STOQ - dispatching app loaded event');
window.dispatchEvent(appLoadedEvent);
}
}
st('form');
var vidEl = form && form.querySelector('[name="id"]');
var variantId = (vidEl && vidEl.value) || _sqTrack.selected_variant_id || '';
// The enabled STOQ selling plan the clicked variant belongs to (if any), found once and
// reused for in_enabled_plan / enrolled_plan_id / enrolled_plan_provider below.
var _sqVidNum = Number(variantId);
var _sqPlan = null;
// Array.isArray guard (not `|| []`) so a truthy non-array sellingPlans can't throw and
// silently drop the whole publish.
var _sqPlans = Array.isArray(_sqTrack.sellingPlans) ? _sqTrack.sellingPlans : [];
_sqPlans.forEach(function (pl) {
if (!_sqPlan && pl && pl.enabled && Array.isArray(pl.variant_ids) &&
pl.variant_ids.indexOf(_sqVidNum) !== -1) { _sqPlan = pl; }
});
Shopify?.analytics?.publish?.('stoq_accelerated_checkout_clicked', {
variant_id: variantId,
product_id: (_sqTromes off a DOM input (.value → string) or
// selected_variant_id, so coerce with Number for a like-typed compare.
is_preorder_variant: (function () {
var vid = Number(variantId);
var has = function (a) { return Array.isArray(a) && a.indexOf(vid) !== -1; };
return has(_sqTrack.preorderVariantIds) ||
has(_sqTrack.cachedPreorderVariantIds &&
_sqTrack.cachedPreorderVariantIds.preorder_variant_ids);
})(),
// Narrow, authoritative preorder signal: enrolled in an ENABLED STOQ selling plan
// (is_preorder_variant above is the broad OOS+continue heuristic — non-STOQ too).
in_enabled_plan: !!_sqPlan,
// In-stock preorder signal: enrolled but currently IN STOCK (in the inStockVariantIds
// set, not the OOS preorderVariantIds set). Same live-OR-cached pattern as
// is_preorder_variant. is_preorder_variant OR
is_instock_variant = "should sell via
// the plan" regardless of stock, so an in-stock preorder bypass is detectable too.
is_instock_variant: (function () {
var has = function (a) { return Array.isArray(a) && a.indexOf(_sqVidNum) !== -1; };
return has(_sqTrack.inStockVariantIds) ||
has(_sqTrack.cachedInStockVariantIds &&
_sqTrack.cachedInStockVariantIds.in_stock_variant_ids);
})(),
// The enrolled plan's Shopify selling-plan id + inventory_provider (stoq = STOQ tracks
// the OOS count; shopify = in-stock preorder). Tells order-debug what kind of preorder
// the Buy Now bypassed, without a downstream lookup.
enrolled_plan_id: (_sqPlan && (_sqPlan.shopify_selling_plan_id || _sqPlan.shopify_selling_plan_group_id)) || '',
enrolled_plan_provider: (_sqPlan && _sqPlan.inventory_provider) || '',
block_enabled: !!(_sqTrack.ca