$product = {"id":7769972179043,"title":"iPhone 14 Pro Mod NX ilovedoodle Meowing Glory - 貓咪藤蔓","handle":"iphone-14-pro-mod-nx-printable-xf50","description":null,"published_at":"2025-04-16T13:08:45+08:00","created_at":"2025-04-15T22:44:48+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":43304852357219,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0126224-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34196837793891,"product_id":7769972179043,"position":2,"created_at":"2025-07-16T14:52:27+08:00","updated_at":"2025-07-16T14:52:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aad527f41c2ce9bf40df1bab4670e666d0dd2f2_3fda6e90-dbb7-444b-a0a8-0a4648be9103.webp?v=1752648749","variant_ids":[43304852357219]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25829571887203,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aad527f41c2ce9bf40df1bab4670e666d0dd2f2_3fda6e90-dbb7-444b-a0a8-0a4648be9103.webp?v=1752648749"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304856256611,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0126204-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34196840939619,"product_id":7769972179043,"position":7,"created_at":"2025-07-16T14:52:30+08:00","updated_at":"2025-07-16T14:52:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/38ff52fe1ec9ec00f019c9053800916cdcae2962_74394dae-9730-4cfe-bd54-40ee17380019.webp?v=1752648752","variant_ids":[43304856256611]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25829572968547,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/38ff52fe1ec9ec00f019c9053800916cdcae2962_74394dae-9730-4cfe-bd54-40ee17380019.webp?v=1752648752"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304856420451,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01262J5-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34196838449251,"product_id":7769972179043,"position":3,"created_at":"2025-07-16T14:52:28+08:00","updated_at":"2025-07-16T14:52:30+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/601c5fda3fecb621bf7847ef34897a21c00deb01_d8857e1f-c53d-4412-9bdc-af7b74914cf5.webp?v=1752648750","variant_ids":[43304856420451]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25829572083811,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/601c5fda3fecb621bf7847ef34897a21c00deb01_d8857e1f-c53d-4412-9bdc-af7b74914cf5.webp?v=1752648750"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e6e88532f3a07375cf04e84ed74e91a351f5db0_15e9eff1-23af-436e-90b7-5a0895ff3497.webp?v=1744728297","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aad527f41c2ce9bf40df1bab4670e666d0dd2f2_3fda6e90-dbb7-444b-a0a8-0a4648be9103.webp?v=1752648749","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/601c5fda3fecb621bf7847ef34897a21c00deb01_d8857e1f-c53d-4412-9bdc-af7b74914cf5.webp?v=1752648750","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/204ac587a3b1fe3d2b993f0597f07bb5f58359df_9adee906-ae6e-47e9-8450-12a8dd1ae013.webp?v=1752648750","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/17f8f0023e66b74578bf910078be28e19a16d45f_6415fea4-41ce-47e3-9742-2f0493c03291.webp?v=1752648751","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f0f76d06c11814a36bd656cd216fe90d1476e7e_bf5570a8-a7ec-495a-ac60-b37e78268126.webp?v=1752648751","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/38ff52fe1ec9ec00f019c9053800916cdcae2962_74394dae-9730-4cfe-bd54-40ee17380019.webp?v=1752648752","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bda55b1a6c361afd1004ee896948d33a84ff265c_3d66dc33-16fd-436a-9426-17cec723df96.webp?v=1752648753","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/459bb10468766c748d60cd59a94e781563626bae_727a88be-f554-4641-b465-f2630936f50c.webp?v=1752648753","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4199dde7d73f85a933f42c516875234040710f53_5c5cea04-db2b-469d-8343-237cbbae3261.webp?v=1752648754","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63426595b7f93260e6e22f798f1da6524da9d560_e6877c57-6895-4bb9-bb28-e459b3658a7e.webp?v=1752648755","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f217a4a302d7122c1c1914540f39864c77338cb0_ff552be8-e18a-45fd-ae1c-d9094f3ac903.webp?v=1752648755","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9c4e4f78b1acf5d4bfde0d9e72676c7b6ffae507_fe4ebb97-28c9-402e-9287-9e619d4ff5c8.webp?v=1752648756"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e6e88532f3a07375cf04e84ed74e91a351f5db0_15e9eff1-23af-436e-90b7-5a0895ff3497.webp?v=1744728297","options":["color"],"media":[{"alt":null,"id":25496626757731,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e6e88532f3a07375cf04e84ed74e91a351f5db0_15e9eff1-23af-436e-90b7-5a0895ff3497.webp?v=1744728297"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2e6e88532f3a07375cf04e84ed74e91a351f5db0_15e9eff1-23af-436e-90b7-5a0895ff3497.webp?v=1744728297","width":2000},{"alt":null,"id":25829571887203,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aad527f41c2ce9bf40df1bab4670e666d0dd2f2_3fda6e90-dbb7-444b-a0a8-0a4648be9103.webp?v=1752648749"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aad527f41c2ce9bf40df1bab4670e666d0dd2f2_3fda6e90-dbb7-444b-a0a8-0a4648be9103.webp?v=1752648749","width":2000},{"alt":null,"id":25829572083811,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/601c5fda3fecb621bf7847ef34897a21c00deb01_d8857e1f-c53d-4412-9bdc-af7b74914cf5.webp?v=1752648750"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/601c5fda3fecb621bf7847ef34897a21c00deb01_d8857e1f-c53d-4412-9bdc-af7b74914cf5.webp?v=1752648750","width":2000},{"alt":null,"id":25829572477027,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/204ac587a3b1fe3d2b993f0597f07bb5f58359df_9adee906-ae6e-47e9-8450-12a8dd1ae013.webp?v=1752648750"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/204ac587a3b1fe3d2b993f0597f07bb5f58359df_9adee906-ae6e-47e9-8450-12a8dd1ae013.webp?v=1752648750","width":2000},{"alt":null,"id":25829572706403,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/17f8f0023e66b74578bf910078be28e19a16d45f_6415fea4-41ce-47e3-9742-2f0493c03291.webp?v=1752648751"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/17f8f0023e66b74578bf910078be28e19a16d45f_6415fea4-41ce-47e3-9742-2f0493c03291.webp?v=1752648751","width":2000},{"alt":null,"id":25829572837475,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f0f76d06c11814a36bd656cd216fe90d1476e7e_bf5570a8-a7ec-495a-ac60-b37e78268126.webp?v=1752648751"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f0f76d06c11814a36bd656cd216fe90d1476e7e_bf5570a8-a7ec-495a-ac60-b37e78268126.webp?v=1752648751","width":2000},{"alt":null,"id":25829572968547,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/38ff52fe1ec9ec00f019c9053800916cdcae2962_74394dae-9730-4cfe-bd54-40ee17380019.webp?v=1752648752"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/38ff52fe1ec9ec00f019c9053800916cdcae2962_74394dae-9730-4cfe-bd54-40ee17380019.webp?v=1752648752","width":2000},{"alt":null,"id":25829573099619,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bda55b1a6c361afd1004ee896948d33a84ff265c_3d66dc33-16fd-436a-9426-17cec723df96.webp?v=1752648753"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bda55b1a6c361afd1004ee896948d33a84ff265c_3d66dc33-16fd-436a-9426-17cec723df96.webp?v=1752648753","width":2000},{"alt":null,"id":25829574606947,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/459bb10468766c748d60cd59a94e781563626bae_727a88be-f554-4641-b465-f2630936f50c.webp?v=1752648753"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/459bb10468766c748d60cd59a94e781563626bae_727a88be-f554-4641-b465-f2630936f50c.webp?v=1752648753","width":2000},{"alt":null,"id":25829574836323,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4199dde7d73f85a933f42c516875234040710f53_5c5cea04-db2b-469d-8343-237cbbae3261.webp?v=1752648754"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4199dde7d73f85a933f42c516875234040710f53_5c5cea04-db2b-469d-8343-237cbbae3261.webp?v=1752648754","width":2000},{"alt":null,"id":25829574967395,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63426595b7f93260e6e22f798f1da6524da9d560_e6877c57-6895-4bb9-bb28-e459b3658a7e.webp?v=1752648755"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63426595b7f93260e6e22f798f1da6524da9d560_e6877c57-6895-4bb9-bb28-e459b3658a7e.webp?v=1752648755","width":2000},{"alt":null,"id":25829575164003,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f217a4a302d7122c1c1914540f39864c77338cb0_ff552be8-e18a-45fd-ae1c-d9094f3ac903.webp?v=1752648755"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f217a4a302d7122c1c1914540f39864c77338cb0_ff552be8-e18a-45fd-ae1c-d9094f3ac903.webp?v=1752648755","width":2000},{"alt":null,"id":25829575393379,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9c4e4f78b1acf5d4bfde0d9e72676c7b6ffae507_fe4ebb97-28c9-402e-9287-9e619d4ff5c8.webp?v=1752648756"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9c4e4f78b1acf5d4bfde0d9e72676c7b6ffae507_fe4ebb97-28c9-402e-9287-9e619d4ff5c8.webp?v=1752648756","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43304852357219,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0126224-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34196837793891,"product_id":7769972179043,"position":2,"created_at":"2025-07-16T14:52:27+08:00","updated_at":"2025-07-16T14:52:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aad527f41c2ce9bf40df1bab4670e666d0dd2f2_3fda6e90-dbb7-444b-a0a8-0a4648be9103.webp?v=1752648749","variant_ids":[43304852357219]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25829571887203,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aad527f41c2ce9bf40df1bab4670e666d0dd2f2_3fda6e90-dbb7-444b-a0a8-0a4648be9103.webp?v=1752648749"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304856256611,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0126204-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34196840939619,"product_id":7769972179043,"position":7,"created_at":"2025-07-16T14:52:30+08:00","updated_at":"2025-07-16T14:52:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/38ff52fe1ec9ec00f019c9053800916cdcae2962_74394dae-9730-4cfe-bd54-40ee17380019.webp?v=1752648752","variant_ids":[43304856256611]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25829572968547,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/38ff52fe1ec9ec00f019c9053800916cdcae2962_74394dae-9730-4cfe-bd54-40ee17380019.webp?v=1752648752"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43304856420451,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01262J5-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34196838449251,"product_id":7769972179043,"position":3,"created_at":"2025-07-16T14:52:28+08:00","updated_at":"2025-07-16T14:52:30+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/601c5fda3fecb621bf7847ef34897a21c00deb01_d8857e1f-c53d-4412-9bdc-af7b74914cf5.webp?v=1752648750","variant_ids":[43304856420451]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25829572083811,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/601c5fda3fecb621bf7847ef34897a21c00deb01_d8857e1f-c53d-4412-9bdc-af7b74914cf5.webp?v=1752648750"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43304852357219,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0126224-XF50","requires_shipping":true,"taxable":true,"featured_image":{"id":34196837793891,"product_id":7769972179043,"position":2,"created_at":"2025-07-16T14:52:27+08:00","updated_at":"2025-07-16T14:52:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aad527f41c2ce9bf40df1bab4670e666d0dd2f2_3fda6e90-dbb7-444b-a0a8-0a4648be9103.webp?v=1752648749","variant_ids":[43304852357219]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Meowing Glory - 貓咪藤蔓 - 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-XF50","featured_media":{"alt":null,"id":25829571887203,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7aad527f41c2ce9bf40df1bab4670e666d0dd2f2_3fda6e90-dbb7-444b-a0a8-0a4648be9103.webp?v=1752648749"}},"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: "停產"
}