$product = {"id":7769617399907,"title":"iPhone XR Mod NX ilovedoodle Cat Dive - 跳水貓咪","handle":"iphone-xr-mod-nx-printable-xf51","description":null,"published_at":"2025-07-16T17:17:33+08:00","created_at":"2025-04-15T18:30:25+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師MOD NX專區-I Love Doodle","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-ilovedoodle","device-iPhone XR","merge","reseller-ilovedoodle"],"price":90000,"price_min":90000,"price_max":90000,"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":43303188922467,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108524-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34196625064035,"product_id":7769617399907,"position":11,"created_at":"2025-07-16T14:47:41+08:00","updated_at":"2025-07-16T14:47:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5990a0d960f649e5ee357ce2967c677995bdb87_4dc964b7-7abf-4cad-a134-662a8de0d4e9.webp?v=1752648462","variant_ids":[43303188922467]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat Dive - 跳水貓咪 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108524-XF51","featured_media":{"alt":null,"id":25829456609379,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5990a0d960f649e5ee357ce2967c677995bdb87_4dc964b7-7abf-4cad-a134-662a8de0d4e9.webp?v=1752648462"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303192592483,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0108504-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34196623065187,"product_id":7769617399907,"position":4,"created_at":"2025-07-16T14:47:37+08:00","updated_at":"2025-07-16T14:47:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/40c134be70ecfd79a689cb50ada4318cb99e8352_0c691fbb-f704-4238-a890-7739739d9aa1.webp?v=1752648458","variant_ids":[43303192592483]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat Dive - 跳水貓咪 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108504-XF51","featured_media":{"alt":null,"id":25829455593571,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/40c134be70ecfd79a689cb50ada4318cb99e8352_0c691fbb-f704-4238-a890-7739739d9aa1.webp?v=1752648458"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303192690787,"title":"Camo Green","option1":"Camo Green","option2":null,"option3":null,"sku":"NPB0108515-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34196623523939,"product_id":7769617399907,"position":6,"created_at":"2025-07-16T14:47:38+08:00","updated_at":"2025-07-16T14:47:40+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63e37b7b0106f694324347229bc6444b1e9104af_17398887-c734-4233-aea7-f48aa223a665.webp?v=1752648460","variant_ids":[43303192690787]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat Dive - 跳水貓咪 - Camo Green","public_title":"Camo Green","options":["Camo Green"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108515-XF51","featured_media":{"alt":null,"id":25829455855715,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63e37b7b0106f694324347229bc6444b1e9104af_17398887-c734-4233-aea7-f48aa223a665.webp?v=1752648460"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303192723555,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01085C1-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34196623917155,"product_id":7769617399907,"position":7,"created_at":"2025-07-16T14:47:38+08:00","updated_at":"2025-07-16T14:47:40+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/336f465ab52d174156f87984676cfe76c680460c_6f73c617-d861-4002-bc5c-83f5b5975990.webp?v=1752648460","variant_ids":[43303192723555]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat Dive - 跳水貓咪 - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01085C1-XF51","featured_media":{"alt":null,"id":25829455986787,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/336f465ab52d174156f87984676cfe76c680460c_6f73c617-d861-4002-bc5c-83f5b5975990.webp?v=1752648460"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5592487ea01bdb94721035e947adb8de9e52691e.webp?v=1744713032","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a4199751f63656a1072732798825d4ce2e21f2ab_6f6a8478-45d2-479b-8ddd-eed21304e278.webp?v=1752648457","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/850b38cb3770384994ddf5005b124a41bdcdc57b_de7dbaf2-6725-41a9-96db-bc8e707493c2.webp?v=1752648458","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/40c134be70ecfd79a689cb50ada4318cb99e8352_0c691fbb-f704-4238-a890-7739739d9aa1.webp?v=1752648458","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b74a6faaa87f0cbcca26f8a410c40938398b8ac_64475b41-e9fc-432f-bcb0-4063064cd754.webp?v=1752648459","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63e37b7b0106f694324347229bc6444b1e9104af_17398887-c734-4233-aea7-f48aa223a665.webp?v=1752648460","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/336f465ab52d174156f87984676cfe76c680460c_6f73c617-d861-4002-bc5c-83f5b5975990.webp?v=1752648460","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3047140b79234b76bcadb5192f187ff2b7e377e_1fa998d1-5b84-4650-b0db-cb709861df71.webp?v=1752648461","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ac36b6a8587cdb5945c4a65fb0a2ba5ccd42ecd_55005396-5a1f-483c-a99b-a1c16fce5e91.webp?v=1752648461","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/211cd3ecdf282c484f2ec764205b54509f9fc8cb_161ed295-444e-4176-95f1-d2305b040d6e.webp?v=1752648462","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5990a0d960f649e5ee357ce2967c677995bdb87_4dc964b7-7abf-4cad-a134-662a8de0d4e9.webp?v=1752648462"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5592487ea01bdb94721035e947adb8de9e52691e.webp?v=1744713032","options":["color"],"media":[{"alt":null,"id":25495970447459,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5592487ea01bdb94721035e947adb8de9e52691e.webp?v=1744713032"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5592487ea01bdb94721035e947adb8de9e52691e.webp?v=1744713032","width":2000},{"alt":null,"id":25829455167587,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a4199751f63656a1072732798825d4ce2e21f2ab_6f6a8478-45d2-479b-8ddd-eed21304e278.webp?v=1752648457"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a4199751f63656a1072732798825d4ce2e21f2ab_6f6a8478-45d2-479b-8ddd-eed21304e278.webp?v=1752648457","width":2000},{"alt":null,"id":25829455364195,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/850b38cb3770384994ddf5005b124a41bdcdc57b_de7dbaf2-6725-41a9-96db-bc8e707493c2.webp?v=1752648458"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/850b38cb3770384994ddf5005b124a41bdcdc57b_de7dbaf2-6725-41a9-96db-bc8e707493c2.webp?v=1752648458","width":2000},{"alt":null,"id":25829455593571,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/40c134be70ecfd79a689cb50ada4318cb99e8352_0c691fbb-f704-4238-a890-7739739d9aa1.webp?v=1752648458"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/40c134be70ecfd79a689cb50ada4318cb99e8352_0c691fbb-f704-4238-a890-7739739d9aa1.webp?v=1752648458","width":2000},{"alt":null,"id":25829455724643,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b74a6faaa87f0cbcca26f8a410c40938398b8ac_64475b41-e9fc-432f-bcb0-4063064cd754.webp?v=1752648459"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b74a6faaa87f0cbcca26f8a410c40938398b8ac_64475b41-e9fc-432f-bcb0-4063064cd754.webp?v=1752648459","width":2000},{"alt":null,"id":25829455855715,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63e37b7b0106f694324347229bc6444b1e9104af_17398887-c734-4233-aea7-f48aa223a665.webp?v=1752648460"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63e37b7b0106f694324347229bc6444b1e9104af_17398887-c734-4233-aea7-f48aa223a665.webp?v=1752648460","width":2000},{"alt":null,"id":25829455986787,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/336f465ab52d174156f87984676cfe76c680460c_6f73c617-d861-4002-bc5c-83f5b5975990.webp?v=1752648460"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/336f465ab52d174156f87984676cfe76c680460c_6f73c617-d861-4002-bc5c-83f5b5975990.webp?v=1752648460","width":2000},{"alt":null,"id":25829456150627,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3047140b79234b76bcadb5192f187ff2b7e377e_1fa998d1-5b84-4650-b0db-cb709861df71.webp?v=1752648461"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3047140b79234b76bcadb5192f187ff2b7e377e_1fa998d1-5b84-4650-b0db-cb709861df71.webp?v=1752648461","width":2000},{"alt":null,"id":25829456248931,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ac36b6a8587cdb5945c4a65fb0a2ba5ccd42ecd_55005396-5a1f-483c-a99b-a1c16fce5e91.webp?v=1752648461"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1ac36b6a8587cdb5945c4a65fb0a2ba5ccd42ecd_55005396-5a1f-483c-a99b-a1c16fce5e91.webp?v=1752648461","width":2000},{"alt":null,"id":25829456412771,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/211cd3ecdf282c484f2ec764205b54509f9fc8cb_161ed295-444e-4176-95f1-d2305b040d6e.webp?v=1752648462"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/211cd3ecdf282c484f2ec764205b54509f9fc8cb_161ed295-444e-4176-95f1-d2305b040d6e.webp?v=1752648462","width":2000},{"alt":null,"id":25829456609379,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5990a0d960f649e5ee357ce2967c677995bdb87_4dc964b7-7abf-4cad-a134-662a8de0d4e9.webp?v=1752648462"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5990a0d960f649e5ee357ce2967c677995bdb87_4dc964b7-7abf-4cad-a134-662a8de0d4e9.webp?v=1752648462","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43303188922467,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108524-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34196625064035,"product_id":7769617399907,"position":11,"created_at":"2025-07-16T14:47:41+08:00","updated_at":"2025-07-16T14:47:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5990a0d960f649e5ee357ce2967c677995bdb87_4dc964b7-7abf-4cad-a134-662a8de0d4e9.webp?v=1752648462","variant_ids":[43303188922467]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat Dive - 跳水貓咪 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108524-XF51","featured_media":{"alt":null,"id":25829456609379,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5990a0d960f649e5ee357ce2967c677995bdb87_4dc964b7-7abf-4cad-a134-662a8de0d4e9.webp?v=1752648462"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303192592483,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0108504-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34196623065187,"product_id":7769617399907,"position":4,"created_at":"2025-07-16T14:47:37+08:00","updated_at":"2025-07-16T14:47:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/40c134be70ecfd79a689cb50ada4318cb99e8352_0c691fbb-f704-4238-a890-7739739d9aa1.webp?v=1752648458","variant_ids":[43303192592483]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat Dive - 跳水貓咪 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108504-XF51","featured_media":{"alt":null,"id":25829455593571,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/40c134be70ecfd79a689cb50ada4318cb99e8352_0c691fbb-f704-4238-a890-7739739d9aa1.webp?v=1752648458"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303192690787,"title":"Camo Green","option1":"Camo Green","option2":null,"option3":null,"sku":"NPB0108515-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34196623523939,"product_id":7769617399907,"position":6,"created_at":"2025-07-16T14:47:38+08:00","updated_at":"2025-07-16T14:47:40+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63e37b7b0106f694324347229bc6444b1e9104af_17398887-c734-4233-aea7-f48aa223a665.webp?v=1752648460","variant_ids":[43303192690787]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat Dive - 跳水貓咪 - Camo Green","public_title":"Camo Green","options":["Camo Green"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108515-XF51","featured_media":{"alt":null,"id":25829455855715,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63e37b7b0106f694324347229bc6444b1e9104af_17398887-c734-4233-aea7-f48aa223a665.webp?v=1752648460"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303192723555,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"NPB01085C1-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34196623917155,"product_id":7769617399907,"position":7,"created_at":"2025-07-16T14:47:38+08:00","updated_at":"2025-07-16T14:47:40+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/336f465ab52d174156f87984676cfe76c680460c_6f73c617-d861-4002-bc5c-83f5b5975990.webp?v=1752648460","variant_ids":[43303192723555]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat Dive - 跳水貓咪 - Lavender","public_title":"Lavender","options":["Lavender"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01085C1-XF51","featured_media":{"alt":null,"id":25829455986787,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/336f465ab52d174156f87984676cfe76c680460c_6f73c617-d861-4002-bc5c-83f5b5975990.webp?v=1752648460"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43303188922467,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108524-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34196625064035,"product_id":7769617399907,"position":11,"created_at":"2025-07-16T14:47:41+08:00","updated_at":"2025-07-16T14:47:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5990a0d960f649e5ee357ce2967c677995bdb87_4dc964b7-7abf-4cad-a134-662a8de0d4e9.webp?v=1752648462","variant_ids":[43303188922467]},"available":true,"name":"iPhone XR Mod NX ilovedoodle Cat Dive - 跳水貓咪 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108524-XF51","featured_media":{"alt":null,"id":25829456609379,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5990a0d960f649e5ee357ce2967c677995bdb87_4dc964b7-7abf-4cad-a134-662a8de0d4e9.webp?v=1752648462"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}; $device_handle = null; $brand_handle = null; $type = ""; var sellingStatus // 只有設計款(SKU 含 '-')才需要合圖 if ($isMerge && $defaultVariant.sku.includes('-')) { $(document).ready(function() { var productImg = $product.images[0]; var bumperImg = window.getProductImageUrl($defaultVariant.sku.split('-')[0]); var layers = ($type === 'mod-nx-backplate' || $type === 'mod-backplate') ? [productImg, bumperImg] : [bumperImg, productImg]; window.mergeProductImages(layers).then(function (mergedImg) { $('.merged-img').attr('src', mergedImg); }); }); }; var sellingStatusData window.fetchSellingStatus().then(data => { try { sellingStatusData = data; } catch (error) { sellingStatusData = null console.error('Unable to parse selling status', error) } $(document).ready(function() { handleSellingStatus($defaultVariant.sku); }); }) function handleSellingStatus(currentSku) { if (!sellingStatusData) { console.error('No selling status available!') return } const sellingStatusElement = document.getElementById('selling-status') const addToCartButton = document.getElementById('AddToCart-product-template') const currentProductSku = currentSku.replace(/-(.*)$/, '-') if ($variants) { const flattenedSellingStatus = [...sellingStatusData.pending, ...sellingStatusData.preorder] const matchSellingStatusProduct = flattenedSellingStatus.filter(product => currentProductSku === product.sku) if (matchSellingStatusProduct.length > 0) { const isProductPending = matchSellingStatusProduct[0].status === 'pending' const matchDate = matchSellingStatusProduct[0].date sellingStatus = isProductPending ? "缺貨中" : "預購完成出貨日:" + matchDate sellingStatusElement.textContent = sellingStatus if (sellingStatus.includes("缺貨中")){ addToCartButton.disabled ='true'; addToCartButton.textContent = "缺貨中無法加入購物車" } else { addToCartButton.textContent = "加到購物車" } } else { sellingStatusElement.textContent = '' addToCartButton.textContent = "加到購物車" }; }; }; document.addEventListener('DOMContentLoaded', function () { var currentVariantSelect = document.getElementById('SingleOptionSelector-0') currentVariantSelect.addEventListener('change', function() { var currentSku = $('#current_sku').text() var skuElement = document.getElementById('current-sku') skuElement.textContent = currentSku handleSellingStatus(currentSku) }); });
// Override default values of shop.strings for each template. // Alternate product templates can change values of // add to cart button, sold out, and unavailable states here. theme.productStrings = { addToCart: "加到購物車", soldOut: "售完", unavailable: "停產" }