$product = {"id":7769731235939,"title":"iPhone 14 Pro Mod NX ilovedoodle Cat People - 貓派","handle":"iphone-14-pro-mod-nx-printable-xf54","description":null,"published_at":"2025-07-16T17:03:56+08:00","created_at":"2025-04-15T20:04:46+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 14 Pro","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":43303747682403,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0126224-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34197241757795,"product_id":7769731235939,"position":7,"created_at":"2025-07-16T15:01:42+08:00","updated_at":"2025-07-16T15:01:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c8ddfb9a81cdb3907bfc00f6f7930bfdaeead8fe_f00ad15b-2d05-4593-8299-880cb22ce21a.webp?v=1752649304","variant_ids":[43303747682403]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Cat People - 貓派 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126224-XF54","featured_media":{"alt":null,"id":25829792055395,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c8ddfb9a81cdb3907bfc00f6f7930bfdaeead8fe_f00ad15b-2d05-4593-8299-880cb22ce21a.webp?v=1752649304"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303753252963,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0126204-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34197243691107,"product_id":7769731235939,"position":13,"created_at":"2025-07-16T15:01:45+08:00","updated_at":"2025-07-16T15:01:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09b1d9aee627ba53e0d23a9205d11bfef59d3607_891da70d-f83a-4697-af7d-394bfb99e23c.webp?v=1752649307","variant_ids":[43303753252963]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Cat People - 貓派 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126204-XF54","featured_media":{"alt":null,"id":25829792972899,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09b1d9aee627ba53e0d23a9205d11bfef59d3607_891da70d-f83a-4697-af7d-394bfb99e23c.webp?v=1752649307"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303753416803,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01262J5-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34197243330659,"product_id":7769731235939,"position":12,"created_at":"2025-07-16T15:01:45+08:00","updated_at":"2025-07-16T15:01:46+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aa1fb01f6669ff8134ccf0a1464899a8506836e_9911e256-4d81-41fe-95b9-5f537d9e79c0.webp?v=1752649306","variant_ids":[43303753416803]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Cat People - 貓派 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01262J5-XF54","featured_media":{"alt":null,"id":25829792874595,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aa1fb01f6669ff8134ccf0a1464899a8506836e_9911e256-4d81-41fe-95b9-5f537d9e79c0.webp?v=1752649306"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/072f4f0efa54a5189a5d932af920da31b1aa7aae_4cb2a09a-16ab-414a-af0d-70d33df9bebc.webp?v=1744718693","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c83092a79b61967ba1617720b850f0f5fdbf5e4d_4721cec8-4e53-4636-bede-453217d7192b.webp?v=1752649301","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/85e5e44518b90762bf41d37c36185e13120a7fdc_d0e46433-16e5-4e71-b524-f08c90f39c6c.webp?v=1752649302","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ea029f8212ba8d3e3f5a4ab50eb5f03f08d3f4cb_6de288e9-a697-4173-aa98-71d5ce13738a.webp?v=1752649302","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c5a993174657f702b2722ce01b7cfb72900c433_b64b2f77-dcb9-48ca-8c2c-3e48c0763fdc.webp?v=1752649303","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b01226acb28ac1b7459e7084d76b775e448accc9_59cfedb8-a689-44b2-b24b-6071ac27dbc0.webp?v=1752649303","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c8ddfb9a81cdb3907bfc00f6f7930bfdaeead8fe_f00ad15b-2d05-4593-8299-880cb22ce21a.webp?v=1752649304","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/55b6c7dfd50cddaf32b7ba968122896f0d62368f_c1f47a51-5a95-46d1-bad4-f83ed6e676fd.webp?v=1752649305","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/86358ff30e0315be411f834d58f44b8c96ddfc4a_a3633d55-da81-416b-8155-908f7876cab6.webp?v=1752649305","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b68d7e617f555d53ec51beb38f16786363dae01b_7cb9b368-1ff1-4e94-a42a-805813937bf9.webp?v=1752649306","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f767ec4afb9870fd2ade0fad2730124e5ac2e9f2_9882a50c-7cad-4c24-a8da-ae81e078c8e6.webp?v=1752649306","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aa1fb01f6669ff8134ccf0a1464899a8506836e_9911e256-4d81-41fe-95b9-5f537d9e79c0.webp?v=1752649306","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09b1d9aee627ba53e0d23a9205d11bfef59d3607_891da70d-f83a-4697-af7d-394bfb99e23c.webp?v=1752649307"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/072f4f0efa54a5189a5d932af920da31b1aa7aae_4cb2a09a-16ab-414a-af0d-70d33df9bebc.webp?v=1744718693","options":["color"],"media":[{"alt":null,"id":25496190845027,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/072f4f0efa54a5189a5d932af920da31b1aa7aae_4cb2a09a-16ab-414a-af0d-70d33df9bebc.webp?v=1744718693"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/072f4f0efa54a5189a5d932af920da31b1aa7aae_4cb2a09a-16ab-414a-af0d-70d33df9bebc.webp?v=1744718693","width":2000},{"alt":null,"id":25829790941283,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c83092a79b61967ba1617720b850f0f5fdbf5e4d_4721cec8-4e53-4636-bede-453217d7192b.webp?v=1752649301"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c83092a79b61967ba1617720b850f0f5fdbf5e4d_4721cec8-4e53-4636-bede-453217d7192b.webp?v=1752649301","width":2000},{"alt":null,"id":25829791137891,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/85e5e44518b90762bf41d37c36185e13120a7fdc_d0e46433-16e5-4e71-b524-f08c90f39c6c.webp?v=1752649302"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/85e5e44518b90762bf41d37c36185e13120a7fdc_d0e46433-16e5-4e71-b524-f08c90f39c6c.webp?v=1752649302","width":2000},{"alt":null,"id":25829791334499,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ea029f8212ba8d3e3f5a4ab50eb5f03f08d3f4cb_6de288e9-a697-4173-aa98-71d5ce13738a.webp?v=1752649302"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ea029f8212ba8d3e3f5a4ab50eb5f03f08d3f4cb_6de288e9-a697-4173-aa98-71d5ce13738a.webp?v=1752649302","width":2000},{"alt":null,"id":25829791760483,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c5a993174657f702b2722ce01b7cfb72900c433_b64b2f77-dcb9-48ca-8c2c-3e48c0763fdc.webp?v=1752649303"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8c5a993174657f702b2722ce01b7cfb72900c433_b64b2f77-dcb9-48ca-8c2c-3e48c0763fdc.webp?v=1752649303","width":2000},{"alt":null,"id":25829791891555,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b01226acb28ac1b7459e7084d76b775e448accc9_59cfedb8-a689-44b2-b24b-6071ac27dbc0.webp?v=1752649303"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b01226acb28ac1b7459e7084d76b775e448accc9_59cfedb8-a689-44b2-b24b-6071ac27dbc0.webp?v=1752649303","width":2000},{"alt":null,"id":25829792055395,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c8ddfb9a81cdb3907bfc00f6f7930bfdaeead8fe_f00ad15b-2d05-4593-8299-880cb22ce21a.webp?v=1752649304"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c8ddfb9a81cdb3907bfc00f6f7930bfdaeead8fe_f00ad15b-2d05-4593-8299-880cb22ce21a.webp?v=1752649304","width":2000},{"alt":null,"id":25829792219235,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/55b6c7dfd50cddaf32b7ba968122896f0d62368f_c1f47a51-5a95-46d1-bad4-f83ed6e676fd.webp?v=1752649305"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/55b6c7dfd50cddaf32b7ba968122896f0d62368f_c1f47a51-5a95-46d1-bad4-f83ed6e676fd.webp?v=1752649305","width":2000},{"alt":null,"id":25829792383075,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/86358ff30e0315be411f834d58f44b8c96ddfc4a_a3633d55-da81-416b-8155-908f7876cab6.webp?v=1752649305"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/86358ff30e0315be411f834d58f44b8c96ddfc4a_a3633d55-da81-416b-8155-908f7876cab6.webp?v=1752649305","width":2000},{"alt":null,"id":25829792514147,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b68d7e617f555d53ec51beb38f16786363dae01b_7cb9b368-1ff1-4e94-a42a-805813937bf9.webp?v=1752649306"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b68d7e617f555d53ec51beb38f16786363dae01b_7cb9b368-1ff1-4e94-a42a-805813937bf9.webp?v=1752649306","width":2000},{"alt":null,"id":25829792645219,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f767ec4afb9870fd2ade0fad2730124e5ac2e9f2_9882a50c-7cad-4c24-a8da-ae81e078c8e6.webp?v=1752649306"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f767ec4afb9870fd2ade0fad2730124e5ac2e9f2_9882a50c-7cad-4c24-a8da-ae81e078c8e6.webp?v=1752649306","width":2000},{"alt":null,"id":25829792874595,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aa1fb01f6669ff8134ccf0a1464899a8506836e_9911e256-4d81-41fe-95b9-5f537d9e79c0.webp?v=1752649306"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aa1fb01f6669ff8134ccf0a1464899a8506836e_9911e256-4d81-41fe-95b9-5f537d9e79c0.webp?v=1752649306","width":2000},{"alt":null,"id":25829792972899,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09b1d9aee627ba53e0d23a9205d11bfef59d3607_891da70d-f83a-4697-af7d-394bfb99e23c.webp?v=1752649307"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09b1d9aee627ba53e0d23a9205d11bfef59d3607_891da70d-f83a-4697-af7d-394bfb99e23c.webp?v=1752649307","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43303747682403,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0126224-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34197241757795,"product_id":7769731235939,"position":7,"created_at":"2025-07-16T15:01:42+08:00","updated_at":"2025-07-16T15:01:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c8ddfb9a81cdb3907bfc00f6f7930bfdaeead8fe_f00ad15b-2d05-4593-8299-880cb22ce21a.webp?v=1752649304","variant_ids":[43303747682403]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Cat People - 貓派 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126224-XF54","featured_media":{"alt":null,"id":25829792055395,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c8ddfb9a81cdb3907bfc00f6f7930bfdaeead8fe_f00ad15b-2d05-4593-8299-880cb22ce21a.webp?v=1752649304"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303753252963,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0126204-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34197243691107,"product_id":7769731235939,"position":13,"created_at":"2025-07-16T15:01:45+08:00","updated_at":"2025-07-16T15:01:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09b1d9aee627ba53e0d23a9205d11bfef59d3607_891da70d-f83a-4697-af7d-394bfb99e23c.webp?v=1752649307","variant_ids":[43303753252963]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Cat People - 貓派 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126204-XF54","featured_media":{"alt":null,"id":25829792972899,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09b1d9aee627ba53e0d23a9205d11bfef59d3607_891da70d-f83a-4697-af7d-394bfb99e23c.webp?v=1752649307"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303753416803,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01262J5-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34197243330659,"product_id":7769731235939,"position":12,"created_at":"2025-07-16T15:01:45+08:00","updated_at":"2025-07-16T15:01:46+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aa1fb01f6669ff8134ccf0a1464899a8506836e_9911e256-4d81-41fe-95b9-5f537d9e79c0.webp?v=1752649306","variant_ids":[43303753416803]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Cat People - 貓派 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01262J5-XF54","featured_media":{"alt":null,"id":25829792874595,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aa1fb01f6669ff8134ccf0a1464899a8506836e_9911e256-4d81-41fe-95b9-5f537d9e79c0.webp?v=1752649306"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43303747682403,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0126224-XF54","requires_shipping":true,"taxable":true,"featured_image":{"id":34197241757795,"product_id":7769731235939,"position":7,"created_at":"2025-07-16T15:01:42+08:00","updated_at":"2025-07-16T15:01:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c8ddfb9a81cdb3907bfc00f6f7930bfdaeead8fe_f00ad15b-2d05-4593-8299-880cb22ce21a.webp?v=1752649304","variant_ids":[43303747682403]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Cat People - 貓派 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126224-XF54","featured_media":{"alt":null,"id":25829792055395,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c8ddfb9a81cdb3907bfc00f6f7930bfdaeead8fe_f00ad15b-2d05-4593-8299-880cb22ce21a.webp?v=1752649304"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}};
$device_handle = null
var sellingStatus
if ($bumper) {
$(document).ready(function() {
var productImg = $product.images[0]
var bumperVariants = $bumper.variants;
var bumperColors = new Object();
var currentVariant = '';
var productType = '';
bumperVariants.forEach(variant => {
bumperColors[`${variant.title.split(' (')[0].toLowerCase()}`] = variant.featured_image.src;
});
if (productType === 'mod-nx-backplate' || productType === 'mod-backplate') {
mergeImages(
[productImg, bumperColors[currentVariant]],
{ crossOrigin: 'anonymous' }
).then(mergedImg => {
$('.merged-img').attr('src', mergedImg);
});
} else {
mergeImages(
[bumperColors[currentVariant], productImg],
{ crossOrigin: 'anonymous' }
).then(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: "停產"
}