{
"@context": "http://schema.org/",
"@type": "Product",
"name": "Trek FX+ 2 LT",
"url": "https:\/\/projektride.co.uk\/products\/trek-fx-2-lt","image": [
"https:\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-C-Primary_1920x.webp?v=1723924281"
],"description": "The FX+ 2 is a lightweight city electric bike that’s designed to make everyday excursions faster and more fun. It has an intuitive and natural feeling pedal-assist system that makes exploring your city extra exciting and cruising up hills a breeze. Useful accessories like a rack and mudguards add even more versatility to this bike\n\n*Please note – spec applies to all sizes unless listed separately\n\n\n Frameset\n\n\n\n\n\n\n\nFrame\nAlpha Gold Aluminium, internal cable routing, internal battery, rack and mudguard mounts, kickstand mount\n\n\nFork\nAlloy, internal brake routing, fender mounts, rack mounts, ThruSkew 5mm QR\n\n\n\n\n\n\n\n\nWheels\n\n\n\n\n\n\n\nHub front\nFormula DC-20, alloy, 6-bolt, 5x100 mm QR\n\n\nSkewer front\n132x5 mm QR\n\n\nHub rear\nHyena hub drive motor, 40 Nm, 250 W\n\n\nRim\nBontrager Connection, double-wall, 32-hole, 20 mm width, Presta valve\n\n\nSpokes\n14 g stainless steel, black\n\n\nTyre\nBontrager H2 Comp, reflective strip, wire bead, 30 tpi, 700x40 mm\n\n\nMax tyre size\n50mm without mudguards, 45mm with mudguards\n\n\n\n\n\n\n\n\nE-system\n\n\n\n\n\n\n\nBattery\n250 Wh, integrated in down tube\n\n\nCharger\n2A, 42V output, 100V–240V AC input\n\n\nComputer\nLED display\n\n\n\n\n\n\n\n\nDrivetrain\n\n\n\n\n\n\n\nShifter\nShimano M315, 8-speed\n\n\nRear derailleur\nShimano Acera M3020-8, 40T max cog\n\n\n*Crank\n\nSize: S, MProWheel Pro alloy, 42T narrow-wide steel ring, 170 mm length\n\n\n\n\nSize: L, XLProWheel Pro alloy, 42T narrow-wide steel ring, 175 mm length\n\n\n\nBottom bracket\nTorque sensor, threaded, 122.5 mm spindle\n\n\nCassette\nShimano HG400, 11-40, 8-speed\n\n\nChain\nKMC Z8.3\n\n\nPedal\nslip-proof pedals with reflectors\n\n\nMax. chainring size\n1x: 44T\n\n\n\n\n\n\n\n\nComponents\n\n\n\n\n\n\n\nSaddle\nBontrager Sport\n\n\n*Seatpost\n\nSize: S, MBontrager alloy, 31.6 mm, 12 mm offset, 330 mm length\n\n\n\nSize: L, XLBontrager alloy, 31.6 mm, 12 mm offset, 400 mm length\n\n\n*Handlebar\n\nSize: S, MBontrager alloy, 31.8 mm, 15 mm rise, 600 mm width\n\n\n\nSize: L, XLBontrager alloy, 31.8 mm, 15 mm rise, 660 mm width\n\n\n\nGrips\nBontrager XR Endurance Comp, lock-on\n\n\n*Stem\n\nSize: S, MBontrager Comp, 31.8 mm, Blendr compatible, 7-degree, 90 mm length\n\n\n\n\nSize: L, XLBontrager Comp, 31.8 mm, Blendr compatible, 7-degree, 100 mm length\n\n\n\nBrake\nShimano hydraulic disc, MT200 lever, UR300 calliper\n\n\nBrake rotor\nShimano RT26, 6-bolt, 160 mm\n\n\nRotor size\nMax brake rotor sizes: 160 mm front and rear\n\n\n\n\n\n\n\n\nAccessories\n\n\n\n\n\n\n\n*Light\n\nSize: S, M, L, XLHerrmans MR4, 120-lumen LED\n\n\n\nSize: S, M, L, XLSpanninga Solo\n\n\n\nKickstand\nPletscher Comp 18\n\n\nCargo rack\nMIK-compatible alloy rear rack, maximum load 25 kg\n\n\n*Mudguard\n\nSize: S, M, L, XLSKS plastic, rear\n\n\n\n\nSize: S, M, L, XLSKS plastic, front\n\n\n\n\n\n\n\n\n\nWeight\n\n\n\n\n\n\n\nWeight\nM - 17.75 kg \/ 39.14 lb\n\n\nWeight limit\nThis bike has a maximum total weight limit (combined weight of bicycle, rider and cargo) of 136 kg (300 lb).\n\n\n\n\n\n\n\n\nWe reserve the right to make changes to the product information contained on this site at any time without notice, including with respect to equipment, specifications, models, colours, materials and pricing. Due to supply chain issues, compatible parts may be substituted at an
Would you like to add on any equipment?
Hire Lazer Compact Helmet
span class="visually-hidden">Hire Kryptolok Standard U-Lock & 4 foot Kryptoflex cable
>
ProjektRide
FAQ
Questions and answers
< Contact Us
Terms of Service
Refund policy
Workshop Prices
Cycle to Work
Delivery & Returns
Sat: 9:00 - 16:00
Sun: Closed
0131 374 5324
Edinburgh
EH9 1QN
[email protected]
9993502946,44329993535714,44329993568482,44957136584930,44957136781538,44957136945378,45068753961186,45068753993954,45069622640866,45069622903010,45069622968546,45069750730978,45069750763746,45353010921698,45353010954466,45353010987234,45353018261730,45353018294498,45353018327266,55569712382335,55569712447871,55569712480639,55570550194559,55570550227327,55604008976767,55638316908927,55638316941695,55638316974463,56220814999935,56220815032703,56270279606655,56270279639423,56270279672191,56314171064703,56314171097471,56398983725439,56398983758207,56398983790975,56399322251647,56565020721535,56565020754303,56565020787071],"updated_at":"2026-02-13T19:54:19Z","market_locations_enabled":false,"market_id":382140642,"preorder_location_filter_enabled":false,"preorder_location_filter_ids":[],"collection_id":null};window._RestockRocketConfig.cachedInStockVariantIds = { in_stock_variant_ids: [] };window._RestockRocketConfig.cachedOutOfStockVariantIds = { out_of_stock_variant_ids: [] };window._RestockRocketConfig.cachedVa
riantPreorderLimits = {"variant_preorder_limits":{},"updated_at":"2026-02-13T19:54:18Z","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-02-13T19:54:18Z","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 del
ivery date.","preorder_button_description_background_color":"#ebebeb","preorder_button_description_text_color":"#000000","preorder_button_description_border_radius":10,"preorder_button_description_show_quantity_limit":false,"preorder_button_description_quantity_limit_suffix":" units available 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_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_int=\"\"\u003e14 g stainless steel, black\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr data-v-05762449=\"\"\u003e\n\u003cth data-v-05762449=\"\" rowspan=\"1\" scope=\"row\"\u003eTyre\u003c\/th\u003e\n\u003ctd data-v-05762449=\"\"\u003eBontrager H2 Comp, reflective strip, wire bead, 30 tpi, 700x40 mm\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr data-v-05762449=\"\"\u003e\n\u003cth data-v-05762449=\"\" scope=\"row\"\u003eMax tyre size\u003c\/th\u003e\n\u003ctd data-v-05762449=\"\"\u003e50mm without mudguards, 45mm with mudguards\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv data-v-5bd42f3c=\"\" data-v-05762449=\"\" id=\"pdl-collapse-item-b5o8q\" name=\"173\" class=\"pdl-collapse-item is-active\"\u003e\n\u003cdiv data-v-5bd42f3c=\"\" role=\"tab\" aria-controls=\"pdl-collapse-content-b5o8q\" aria-describedby=\"pdl-collapse-content-b5o8q\" class=\"\" aria-expanded=\"true\" qaid=\"\"\u003e\n\u003cdiv data-v-5bd42f3c=\"\" cl
ass=\"flex items-center flex-grow\"\u003eE-system\u003c\/div\u003e\n\u003cbutton data-v-5bd42f3c=\"\" id=\"pdl-collapse-head-b5o8q\" type=\"button\" class=\"pdl-collapse-item__header is-active flex-row-reverse items-center\" tabindex=\"0\"\u003e\u003csvg data-v-1e7396ba=\"\" data-v-5bd42f3c=\"\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 24 24\" width=\"24px\" height=\"24px\" fill=\"currentcolor\" aria-hidden=\"true\" role=\"presentation\" class=\"pdl-collapse-item__icon pdl-icon pdl-icon--size-24 is-active\" qaid=\"\"\u003e\u003cpath d=\"M0 0h24v24H0z\" fill=\"none\"\u003e\u003c\/path\u003e\u003cpath d=\"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z\"\u003e\u003c\/path\u003e\u003c\/svg\u003e\u003c\/button\u003e\n\u003c\/div\u003e\n\u003cdiv data-v-5bd42f3c=\"\" id=\"pdl-collapse-content-b5o8q\" role=\"tabpanel\" aria-labelledby=\"pdl-collapse-head-b5o8q\" class=\"pdl-collapse-item__wrap\" data-old-padding-top=\"\" data-old-padding-bottom=\"\" data-old-overflow=\"\"\u003e\n\u003cdiv data-v-5bd42f
3e\n\u003cth data-v-05762449=\"\" scope=\"row\"\u003eWeight\u003c\/th\u003e\n\u003ctd data-v-05762449=\"\"\u003eM - 17.75 kg \/ 39.14 lb\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr data-v-05762449=\"\"\u003e\n\u003cth data-v-05762449=\"\" scope=\"row\"\u003eWeight limit\u003c\/th\u003e\n\u003ctd data-v-05762449=\"\"\u003eThis bike has a maximum total weight limit (combined weight of bicycle, rider and cargo) of 136 kg (300 lb).\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"mb-1\"\u003e\n\u003cp\u003eWe reserve the right to make changes to the product information contained on this site at any time without notice, including with respect to equipment, specifications, models, colours, materials and pricing. Due to supply chain issues, compatible parts may be substituted at any time without notice. The prices shown are the manufacturer's suggested retail prices.\u003c\/p\u003e\n\u003c\/div\u
003e\n\u003cdiv class=\"mb-1\"\u003e\n\u003cp\u003eBike and frame weights are based on pre-production painted frames at time of publication. Weights may vary in final production.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003c!----\u003e","published_at":"2025-11-12T16:23:40+00:00","created_at":"2024-08-17T20:54:15+01:00","vendor":"Trek","type":"bike","tags":["FX"],"price":212500,"price_min":212500,"price_max":212500,"available":true,"price_varies":false,"compare_at_price":null,"compare_at_price_min":0,"compare_at_price_max":0,"compare_at_price_varies":false,"variants":[{"id":45824516194530,"title":"Blue \/ Small","option1":"Blue","option2":"Small","option3":null,"sku":"5291479","requires_shipping":true,"taxable":true,"featured_image":{"id":41897497198818,"product_id":8678991167714,"position":1,"created_at":"2024-08-17T20:51:19+01:00","updated_at":"2024-08-17T20:51:21+01:00","alt":null,"width":1920,"height":1440,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-C-Primary.webp?v=1723924281","varia
p\/files\/FXPlus2LTMen-24-40490-A-Primary.webp?v=1723924283","variant_ids":[45824516456674,45824516489442,45824516522210,45824516554978]},"available":true,"name":"Trek FX+ 2 LT - Black \/ Large","public_title":"Black \/ Large","options":["Black","Large"],"price":212500,"weight":0,"compare_at_price":null,"inventory_management":"shopify","barcode":"","featured_media":{"alt":null,"id":34472372273378,"position":3,"preview_image":{"aspect_ratio":1.333,"height":1440,"width":1920,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-A-Primary.webp?v=1723924283"}},"requires_selling_plan":false,"selling_plan_allocations":[]},{"id":45824516554978,"title":"Black \/ Extra Large","option1":"Black","option2":"Extra Large","option3":null,"sku":"5291490","requires_shipping":true,"taxable":true,"featured_image":{"id":41897497264354,"product_id":8678991167714,"position":3,"created_at":"2024-08-17T20:51:22+01:00","updated_at":"2024-08-17T20:51:23+01:00","alt":null,"width":1920,"height":1440,"src":"\/\/projektrid
e.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-A-Primary.webp?v=1723924283","variant_ids":[45824516456674,45824516489442,45824516522210,45824516554978]},"available":true,"name":"Trek FX+ 2 LT - Black \/ Extra Large","public_title":"Black \/ Extra Large","options":["Black","Extra Large"],"price":212500,"weight":0,"compare_at_price":null,"inventory_management":"shopify","barcode":"","featured_media":{"alt":null,"id":34472372273378,"position":3,"preview_image":{"aspect_ratio":1.333,"height":1440,"width":1920,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-A-Primary.webp?v=1723924283"}},"requires_selling_plan":false,"selling_plan_allocations":[]}],"images":["\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-C-Primary.webp?v=1723924281","\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-B-Primary.webp?v=1723924278","\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-A-Primary.webp?v=1723924283","\/\/projektride.co.uk\/cdn\/shop\/files\/Screenshot_2024-1
1-13_at_11.10.07.png?v=1731496232"],"featured_image":"\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-C-Primary.webp?v=1723924281","options":["Color","Size"],"media":[{"alt":null,"id":34472371945698,"position":1,"preview_image":{"aspect_ratio":1.333,"height":1440,"width":1920,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-C-Primary.webp?v=1723924281"},"aspect_ratio":1.333,"height":1440,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-C-Primary.webp?v=1723924281","width":1920},{"alt":null,"id":34472371912930,"position":2,"preview_image":{"aspect_ratio":1.333,"height":1440,"width":1920,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-B-Primary.webp?v=1723924278"},"aspect_ratio":1.333,"height":1440,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-B-Primary.webp?v=1723924278","width":1920},{"alt":null,"id":34472372273378,"position":3,"preview_image":{"aspect_ratio":1.333,"
height":1440,"width":1920,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-A-Primary.webp?v=1723924283"},"aspect_ratio":1.333,"height":1440,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/FXPlus2LTMen-24-40490-A-Primary.webp?v=1723924283","width":1920},{"alt":null,"id":63181772128639,"position":4,"preview_image":{"aspect_ratio":4.391,"height":726,"width":3188,"src":"\/\/projektride.co.uk\/cdn\/shop\/files\/Screenshot_2024-11-13_at_11.10.07.png?v=1731496232"},"aspect_ratio":4.391,"height":726,"media_type":"image","src":"\/\/projektride.co.uk\/cdn\/shop\/files\/Screenshot_2024-11-13_at_11.10.07.png?v=1731496232","width":3188}],"requires_selling_plan":false,"selling_plan_groups":[],"content":"\u003cp\u003e\u003cmeta charset=\"utf-8\"\u003e\u003cspan\u003eThe FX+ 2 is a lightweight city electric bike that’s designed to make everyday excursions faster and more fun. It has an intuitive and natural feeling pedal-assist system that makes exploring your city extra exciting a
003e\n\u003cdiv data-v-5bd42f3c=\"\" id=\"pdl-collapse-content-s2w22nyo\" role=\"tabpanel\" aria-labelledby=\"pdl-collapse-head-s2w22nyo\" class=\"pdl-collapse-item__wrap\" data-old-padding-top=\"\" data-old-padding-bottom=\"\" data-old-overflow=\"\"\u003e\n\u003cdiv data-v-5bd42f3c=\"\" class=\"pdl-collapse-item__content\"\u003e\n\u003ctable data-v-05762449=\"\" aria-label=\"Specifications\" class=\"sprocket__table spec\"\u003e\n\u003ctbody data-v-05762449=\"\"\u003e\n\u003ctr data-v-05762449=\"\"\u003e\n\u003cth data-v-05762449=\"\" scope=\"row\"\u003eWeight\u003c\/th\u003e\n\u003ctd data-v-05762449=\"\"\u003eM - 17.75 kg \/ 39.14 lb\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003ctr data-v-05762449=\"\"\u003e\n\u003cth data-v-05762449=\"\" scope=\"row\"\u003eWeight limit\u003c\/th\u003e\n\u003ctd data-v-05762449=\"\"\u003eThis bike has a maximum total weight limit (combined weight of bicycle, rider and cargo) of 136 kg (300 lb).\u003c\/td\u003e\n\u003c\/tr\u003e\n\u003c\/tbody\u003e\n\u003c\/table\u003e\n\u003c\/
div\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"mb-1\"\u003e\n\u003cp\u003eWe reserve the right to make changes to the product information contained on this site at any time without notice, including with respect to equipment, specifications, models, colours, materials and pricing. Due to supply chain issues, compatible parts may be substituted at any time without notice. The prices shown are the manufacturer's suggested retail prices.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"mb-1\"\u003e\n\u003cp\u003eBike and frame weights are based on pre-production painted frames at time of publication. Weights may vary in final production.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003c!----\u003e"};
window._RestockRocketConfig.variantsInventoryPolicy = {45824516194530 : "deny",45824516227298 : "deny",45824516260066 : "deny",45824516292834 : "deny",45824516325602 : "deny",45824516358370 : "deny",45824516391138 : "deny",45824516423906 : "deny",45824516456674 : "deny",4582451
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
<
= 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
translation data in metafield
// Metafield hasn't been backfilled yet - force refresh
console.debug('STOQ - multi-language enabled but no translation data in cache, fetching fresh');
return null;
}
// Translations object exists in metafield - cache is valid
// If current locale isn't translated, applyTranslations will gracefully use default locale from base fields
if (window._RestockRocketConfig.normalizedLocale &&
!Object.prototype.hasOwnProperty.call(settings.translations, window._RestockRocketConfig.normalizedLocale)) {
console.debug('STOQ - locale not explicitly translated, will use default language from cache');
}
// Don't return null - continue using cache even for untranslated locales
}
const updatedAt = new Date(settings.updated_at);
if (isNaN(updatedAt.getTime())) {
console.debug('STOQ - Invalid updated_at date format in settings');
return null;
}
const
ry check
const cachedSettings = window._RestockRocketConfig.cachedSettings;
const validCachedSettings = cachedSettings ? checkSettingsExpiry(cachedSettings) : null;
if (validCachedSettings) {
console.debug('STOQ - using cached settings');
initializeScripts(validCachedSettings);
} else {
console.debug('STOQ - fetching fresh settings');
const headers = {
'X-Shopify-Shop-Domain': window._RestockRocketConfig.shop || window.Shopify.shop,
'ngrok-skip-browser-warning': 'skip'
};
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('STOQ - failed to load settings:', error);
}
})
.catch(function(e) {
console.error(e)
})
}
function initializeScripts(settings) {
settings = applyTranslations(settings);
window._RestockRocketConfig.settings = settings;
console.debug(`STOQ - settings configured for ${window._RestockRocketConfig.pageType}`);
// Setup cart selling plan updater BEFORE loading any scripts to avoid race conditions
setupCartSellingPlanUpdater(settings);
if(settings.enable_app) {