$product = {"id":6983864320099,"title":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA 拼貼系列-布魯克林籃網 Brooklyn Nets - Collage","handle":"iphone-13-mini-solidsuit-classic-magsafe-pm81","description":null,"published_at":"2023-08-02T22:20:24+08:00","created_at":"2023-07-28T12:58:56+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師SolidSuit MagSafe專區-爽爽貓 Song Song Meow By SECOND","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-nba","device-iPhone 13 Mini","merge","reseller-nba"],"price":125000,"price_min":125000,"price_max":125000,"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":43102636179555,"title":"Black \/ Classic","option1":"Black","option2":"Classic","option3":null,"sku":"MST0122852-PM81","requires_shipping":true,"taxable":true,"featured_image":{"id":30278455656547,"product_id":6983864320099,"position":1,"created_at":"2023-07-28T12:58:58+08:00","updated_at":"2023-07-28T12:58:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338","variant_ids":[43102636179555,43102636343395]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA 拼貼系列-布魯克林籃網 Brooklyn Nets - Collage - Black \/ Classic","public_title":"Black \/ Classic","options":["Black","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-PM81","featured_media":{"alt":null,"id":22637087457379,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43102636343395,"title":"Seaweed Green \/ Classic","option1":"Seaweed Green","option2":"Classic","option3":null,"sku":"MST01228Z8-PM81","requires_shipping":true,"taxable":true,"featured_image":{"id":30278455656547,"product_id":6983864320099,"position":1,"created_at":"2023-07-28T12:58:58+08:00","updated_at":"2023-07-28T12:58:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338","variant_ids":[43102636179555,43102636343395]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA 拼貼系列-布魯克林籃網 Brooklyn Nets - Collage - Seaweed Green \/ Classic","public_title":"Seaweed Green \/ Classic","options":["Seaweed Green","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z8-PM81","featured_media":{"alt":null,"id":22637087457379,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/22e2cf98c54132491a773550b52d1583dadbce7b.webp?v=1782205170","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aee25fd706d46ab086a7b2b2145cb29984ff8d.webp?v=1782205170","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0b922264f3bf596cd6146a59922ec4868467c0d.webp?v=1782205171","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bbf82a94cab0f474879d1da06fa6d0e4a005cc0.webp?v=1782205171","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/22e2cf98c54132491a773550b52d1583dadbce7b_02209fd3-559a-468e-83ce-30d6dfdd1b5e.webp?v=1782218447","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aee25fd706d46ab086a7b2b2145cb29984ff8d_cc277bbc-28a0-4b99-9f37-4d58b82aac42.webp?v=1782218448","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0b922264f3bf596cd6146a59922ec4868467c0d_cbddd16f-e2db-4f9b-8087-93c059d2dbac.webp?v=1782218449","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bbf82a94cab0f474879d1da06fa6d0e4a005cc0_2b4ade32-9ee3-4320-87b9-538c3f1163de.webp?v=1782218449","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/22e2cf98c54132491a773550b52d1583dadbce7b_652dc7ed-0f57-46e9-a57d-f67eb3841886.webp?v=1782218770","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aee25fd706d46ab086a7b2b2145cb29984ff8d_1f8d5a89-30f4-46be-a2a8-65ceb3c62233.webp?v=1782218770","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0b922264f3bf596cd6146a59922ec4868467c0d_dadc46a7-d8e0-4767-802c-be22edf48d0a.webp?v=1782218771","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bbf82a94cab0f474879d1da06fa6d0e4a005cc0_b7942c9e-18fa-4851-8844-af4d0fef235f.webp?v=1782218772","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/22e2cf98c54132491a773550b52d1583dadbce7b_32a89cf0-ed09-452d-b412-f00ce9cd0a5c.webp?v=1782219057","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aee25fd706d46ab086a7b2b2145cb29984ff8d_3413c3bc-95b3-41da-aa1f-7eec920658fa.webp?v=1782219058","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0b922264f3bf596cd6146a59922ec4868467c0d_e213e3de-79b2-4fa5-9746-78d7948c2ef9.webp?v=1782219058","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bbf82a94cab0f474879d1da06fa6d0e4a005cc0_5cfd6004-74f2-4b8f-8a8d-23b6476f6f79.webp?v=1782219059"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338","options":["color","Types"],"media":[{"alt":null,"id":22637087457379,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338","width":2000},{"alt":null,"id":27575149887587,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/22e2cf98c54132491a773550b52d1583dadbce7b.webp?v=1782205170"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/22e2cf98c54132491a773550b52d1583dadbce7b.webp?v=1782205170","width":2000},{"alt":null,"id":27575150116963,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aee25fd706d46ab086a7b2b2145cb29984ff8d.webp?v=1782205170"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aee25fd706d46ab086a7b2b2145cb29984ff8d.webp?v=1782205170","width":2000},{"alt":null,"id":27575150346339,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0b922264f3bf596cd6146a59922ec4868467c0d.webp?v=1782205171"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0b922264f3bf596cd6146a59922ec4868467c0d.webp?v=1782205171","width":2000},{"alt":null,"id":27575150542947,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bbf82a94cab0f474879d1da06fa6d0e4a005cc0.webp?v=1782205171"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bbf82a94cab0f474879d1da06fa6d0e4a005cc0.webp?v=1782205171","width":2000},{"alt":null,"id":27581468409955,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/22e2cf98c54132491a773550b52d1583dadbce7b_02209fd3-559a-468e-83ce-30d6dfdd1b5e.webp?v=1782218447"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/22e2cf98c54132491a773550b52d1583dadbce7b_02209fd3-559a-468e-83ce-30d6dfdd1b5e.webp?v=1782218447","width":2000},{"alt":null,"id":27581468737635,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aee25fd706d46ab086a7b2b2145cb29984ff8d_cc277bbc-28a0-4b99-9f37-4d58b82aac42.webp?v=1782218448"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aee25fd706d46ab086a7b2b2145cb29984ff8d_cc277bbc-28a0-4b99-9f37-4d58b82aac42.webp?v=1782218448","width":2000},{"alt":null,"id":27581468999779,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0b922264f3bf596cd6146a59922ec4868467c0d_cbddd16f-e2db-4f9b-8087-93c059d2dbac.webp?v=1782218449"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0b922264f3bf596cd6146a59922ec4868467c0d_cbddd16f-e2db-4f9b-8087-93c059d2dbac.webp?v=1782218449","width":2000},{"alt":null,"id":27581469458531,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bbf82a94cab0f474879d1da06fa6d0e4a005cc0_2b4ade32-9ee3-4320-87b9-538c3f1163de.webp?v=1782218449"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bbf82a94cab0f474879d1da06fa6d0e4a005cc0_2b4ade32-9ee3-4320-87b9-538c3f1163de.webp?v=1782218449","width":2000},{"alt":null,"id":27581645783139,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/22e2cf98c54132491a773550b52d1583dadbce7b_652dc7ed-0f57-46e9-a57d-f67eb3841886.webp?v=1782218770"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/22e2cf98c54132491a773550b52d1583dadbce7b_652dc7ed-0f57-46e9-a57d-f67eb3841886.webp?v=1782218770","width":2000},{"alt":null,"id":27581646143587,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aee25fd706d46ab086a7b2b2145cb29984ff8d_1f8d5a89-30f4-46be-a2a8-65ceb3c62233.webp?v=1782218770"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aee25fd706d46ab086a7b2b2145cb29984ff8d_1f8d5a89-30f4-46be-a2a8-65ceb3c62233.webp?v=1782218770","width":2000},{"alt":null,"id":27581646274659,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0b922264f3bf596cd6146a59922ec4868467c0d_dadc46a7-d8e0-4767-802c-be22edf48d0a.webp?v=1782218771"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0b922264f3bf596cd6146a59922ec4868467c0d_dadc46a7-d8e0-4767-802c-be22edf48d0a.webp?v=1782218771","width":2000},{"alt":null,"id":27581646471267,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bbf82a94cab0f474879d1da06fa6d0e4a005cc0_b7942c9e-18fa-4851-8844-af4d0fef235f.webp?v=1782218772"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bbf82a94cab0f474879d1da06fa6d0e4a005cc0_b7942c9e-18fa-4851-8844-af4d0fef235f.webp?v=1782218772","width":2000},{"alt":null,"id":27581789831267,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/22e2cf98c54132491a773550b52d1583dadbce7b_32a89cf0-ed09-452d-b412-f00ce9cd0a5c.webp?v=1782219057"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/22e2cf98c54132491a773550b52d1583dadbce7b_32a89cf0-ed09-452d-b412-f00ce9cd0a5c.webp?v=1782219057","width":2000},{"alt":null,"id":27581790093411,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aee25fd706d46ab086a7b2b2145cb29984ff8d_3413c3bc-95b3-41da-aa1f-7eec920658fa.webp?v=1782219058"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aee25fd706d46ab086a7b2b2145cb29984ff8d_3413c3bc-95b3-41da-aa1f-7eec920658fa.webp?v=1782219058","width":2000},{"alt":null,"id":27581790191715,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0b922264f3bf596cd6146a59922ec4868467c0d_e213e3de-79b2-4fa5-9746-78d7948c2ef9.webp?v=1782219058"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d0b922264f3bf596cd6146a59922ec4868467c0d_e213e3de-79b2-4fa5-9746-78d7948c2ef9.webp?v=1782219058","width":2000},{"alt":null,"id":27581790584931,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bbf82a94cab0f474879d1da06fa6d0e4a005cc0_5cfd6004-74f2-4b8f-8a8d-23b6476f6f79.webp?v=1782219059"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4bbf82a94cab0f474879d1da06fa6d0e4a005cc0_5cfd6004-74f2-4b8f-8a8d-23b6476f6f79.webp?v=1782219059","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43102636179555,"title":"Black \/ Classic","option1":"Black","option2":"Classic","option3":null,"sku":"MST0122852-PM81","requires_shipping":true,"taxable":true,"featured_image":{"id":30278455656547,"product_id":6983864320099,"position":1,"created_at":"2023-07-28T12:58:58+08:00","updated_at":"2023-07-28T12:58:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338","variant_ids":[43102636179555,43102636343395]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA 拼貼系列-布魯克林籃網 Brooklyn Nets - Collage - Black \/ Classic","public_title":"Black \/ Classic","options":["Black","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-PM81","featured_media":{"alt":null,"id":22637087457379,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43102636343395,"title":"Seaweed Green \/ Classic","option1":"Seaweed Green","option2":"Classic","option3":null,"sku":"MST01228Z8-PM81","requires_shipping":true,"taxable":true,"featured_image":{"id":30278455656547,"product_id":6983864320099,"position":1,"created_at":"2023-07-28T12:58:58+08:00","updated_at":"2023-07-28T12:58:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338","variant_ids":[43102636179555,43102636343395]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA 拼貼系列-布魯克林籃網 Brooklyn Nets - Collage - Seaweed Green \/ Classic","public_title":"Seaweed Green \/ Classic","options":["Seaweed Green","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z8-PM81","featured_media":{"alt":null,"id":22637087457379,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43102636179555,"title":"Black \/ Classic","option1":"Black","option2":"Classic","option3":null,"sku":"MST0122852-PM81","requires_shipping":true,"taxable":true,"featured_image":{"id":30278455656547,"product_id":6983864320099,"position":1,"created_at":"2023-07-28T12:58:58+08:00","updated_at":"2023-07-28T12:58:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338","variant_ids":[43102636179555,43102636343395]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA 拼貼系列-布魯克林籃網 Brooklyn Nets - Collage - Black \/ Classic","public_title":"Black \/ Classic","options":["Black","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-PM81","featured_media":{"alt":null,"id":22637087457379,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM81_5a0aa8f7-3ec2-4842-9c32-6bff514d26c8.png?v=1690520338"}},"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: "停產"
}