$product = {"id":7937809317987,"title":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 獻出你的心臟!","handle":"iphone-12-mini-solidsuit-classic-xu12","description":null,"published_at":"2025-12-12T10:56:25+08:00","created_at":"2025-12-11T15:31:46+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-attack-on-titan","device-iPhone 12 Mini","merge","reseller-attack-on-titan"],"price":83000,"price_min":83000,"price_max":83000,"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":43883979440227,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"SST0118452-XU12","requires_shipping":true,"taxable":true,"featured_image":{"id":36225788674147,"product_id":7937809317987,"position":10,"created_at":"2026-07-09T09:33:54+08:00","updated_at":"2026-07-09T09:33:56+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/507a47ca2f3aab79b16c5cf10c2682a454ef8d47_854e02a0-3b95-4ac2-99db-22cde756dfc9.webp?v=1783560836","variant_ids":[43883979440227]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 獻出你的心臟! - Black","public_title":"Black","options":["Black"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST0118452-XU12","featured_media":{"alt":null,"id":27730574311523,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/507a47ca2f3aab79b16c5cf10c2682a454ef8d47_854e02a0-3b95-4ac2-99db-22cde756dfc9.webp?v=1783560836"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883979505763,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"SST01184O9-XU12","requires_shipping":true,"taxable":true,"featured_image":{"id":36225791033443,"product_id":7937809317987,"position":14,"created_at":"2026-07-09T09:33:57+08:00","updated_at":"2026-07-09T09:33:59+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f99dcc5e8821027b01ad88cc469e7c6edca8f98a_07ac8ce5-c04d-4c0a-9d68-8d5dfd97a969.webp?v=1783560839","variant_ids":[43883979505763]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 獻出你的心臟! - Cobalt Blue","public_title":"Cobalt Blue","options":["Cobalt Blue"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01184O9-XU12","featured_media":{"alt":null,"id":27730576638051,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f99dcc5e8821027b01ad88cc469e7c6edca8f98a_07ac8ce5-c04d-4c0a-9d68-8d5dfd97a969.webp?v=1783560839"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883979538531,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"SST011840B-XU12","requires_shipping":true,"taxable":true,"featured_image":{"id":36225789100131,"product_id":7937809317987,"position":11,"created_at":"2026-07-09T09:33:55+08:00","updated_at":"2026-07-09T09:33:57+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b8a79fb6882af3fe465a878542ae93099dfa314_47482699-b8c4-4763-b64e-e8e39dd3c6cf.webp?v=1783560837","variant_ids":[43883979538531]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 獻出你的心臟! - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST011840B-XU12","featured_media":{"alt":null,"id":27730574737507,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b8a79fb6882af3fe465a878542ae93099dfa314_47482699-b8c4-4763-b64e-e8e39dd3c6cf.webp?v=1783560837"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f99dcc5e8821027b01ad88cc469e7c6edca8f98a.webp?v=1765438312","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d37fe47210a27dc360141d6e1251e004100e6836.webp?v=1765438312","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/126ba5ff82cdc2f85f9fff1967c9ad3d3f48fbfb.webp?v=1765438313","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be981df19674bc94d0448f966b3a20e85a6548eb.webp?v=1765438313","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02dd1b2cd287386228557980cce7a0b38aabb1b2.webp?v=1765438314","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b8a79fb6882af3fe465a878542ae93099dfa314.webp?v=1765438317","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/507a47ca2f3aab79b16c5cf10c2682a454ef8d47.webp?v=1765438317","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0da22177343641482c45c1910a8d53918391a37c.webp?v=1765438318","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/50f33ec5baef2d129e3d31b399f62cfd22e3fc3e.webp?v=1765438318","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/507a47ca2f3aab79b16c5cf10c2682a454ef8d47_854e02a0-3b95-4ac2-99db-22cde756dfc9.webp?v=1783560836","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b8a79fb6882af3fe465a878542ae93099dfa314_47482699-b8c4-4763-b64e-e8e39dd3c6cf.webp?v=1783560837","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/126ba5ff82cdc2f85f9fff1967c9ad3d3f48fbfb_b722bd41-1979-43b7-a53a-117c8c0c4f48.webp?v=1783560838","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/50f33ec5baef2d129e3d31b399f62cfd22e3fc3e_88e95833-5cfc-4cb1-91bd-d79505ccd215.webp?v=1783560838","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f99dcc5e8821027b01ad88cc469e7c6edca8f98a_07ac8ce5-c04d-4c0a-9d68-8d5dfd97a969.webp?v=1783560839","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be981df19674bc94d0448f966b3a20e85a6548eb_cc6d60a1-c6ae-452d-b60a-44abc8781803.webp?v=1783560840"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f99dcc5e8821027b01ad88cc469e7c6edca8f98a.webp?v=1765438312","options":["color"],"media":[{"alt":null,"id":26494991499363,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f99dcc5e8821027b01ad88cc469e7c6edca8f98a.webp?v=1765438312"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f99dcc5e8821027b01ad88cc469e7c6edca8f98a.webp?v=1765438312","width":2000},{"alt":null,"id":26494991630435,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d37fe47210a27dc360141d6e1251e004100e6836.webp?v=1765438312"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d37fe47210a27dc360141d6e1251e004100e6836.webp?v=1765438312","width":2000},{"alt":null,"id":26494991827043,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/126ba5ff82cdc2f85f9fff1967c9ad3d3f48fbfb.webp?v=1765438313"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/126ba5ff82cdc2f85f9fff1967c9ad3d3f48fbfb.webp?v=1765438313","width":2000},{"alt":null,"id":26494992056419,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be981df19674bc94d0448f966b3a20e85a6548eb.webp?v=1765438313"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be981df19674bc94d0448f966b3a20e85a6548eb.webp?v=1765438313","width":2000},{"alt":null,"id":26494992384099,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02dd1b2cd287386228557980cce7a0b38aabb1b2.webp?v=1765438314"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/02dd1b2cd287386228557980cce7a0b38aabb1b2.webp?v=1765438314","width":2000},{"alt":null,"id":26494992842851,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b8a79fb6882af3fe465a878542ae93099dfa314.webp?v=1765438317"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b8a79fb6882af3fe465a878542ae93099dfa314.webp?v=1765438317","width":2000},{"alt":null,"id":26494993137763,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/507a47ca2f3aab79b16c5cf10c2682a454ef8d47.webp?v=1765438317"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/507a47ca2f3aab79b16c5cf10c2682a454ef8d47.webp?v=1765438317","width":2000},{"alt":null,"id":26494993367139,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0da22177343641482c45c1910a8d53918391a37c.webp?v=1765438318"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0da22177343641482c45c1910a8d53918391a37c.webp?v=1765438318","width":2000},{"alt":null,"id":26494993530979,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/50f33ec5baef2d129e3d31b399f62cfd22e3fc3e.webp?v=1765438318"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/50f33ec5baef2d129e3d31b399f62cfd22e3fc3e.webp?v=1765438318","width":2000},{"alt":null,"id":27730574311523,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/507a47ca2f3aab79b16c5cf10c2682a454ef8d47_854e02a0-3b95-4ac2-99db-22cde756dfc9.webp?v=1783560836"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/507a47ca2f3aab79b16c5cf10c2682a454ef8d47_854e02a0-3b95-4ac2-99db-22cde756dfc9.webp?v=1783560836","width":2000},{"alt":null,"id":27730574737507,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b8a79fb6882af3fe465a878542ae93099dfa314_47482699-b8c4-4763-b64e-e8e39dd3c6cf.webp?v=1783560837"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b8a79fb6882af3fe465a878542ae93099dfa314_47482699-b8c4-4763-b64e-e8e39dd3c6cf.webp?v=1783560837","width":2000},{"alt":null,"id":27730575392867,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/126ba5ff82cdc2f85f9fff1967c9ad3d3f48fbfb_b722bd41-1979-43b7-a53a-117c8c0c4f48.webp?v=1783560838"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/126ba5ff82cdc2f85f9fff1967c9ad3d3f48fbfb_b722bd41-1979-43b7-a53a-117c8c0c4f48.webp?v=1783560838","width":2000},{"alt":null,"id":27730575982691,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/50f33ec5baef2d129e3d31b399f62cfd22e3fc3e_88e95833-5cfc-4cb1-91bd-d79505ccd215.webp?v=1783560838"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/50f33ec5baef2d129e3d31b399f62cfd22e3fc3e_88e95833-5cfc-4cb1-91bd-d79505ccd215.webp?v=1783560838","width":2000},{"alt":null,"id":27730576638051,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f99dcc5e8821027b01ad88cc469e7c6edca8f98a_07ac8ce5-c04d-4c0a-9d68-8d5dfd97a969.webp?v=1783560839"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f99dcc5e8821027b01ad88cc469e7c6edca8f98a_07ac8ce5-c04d-4c0a-9d68-8d5dfd97a969.webp?v=1783560839","width":2000},{"alt":null,"id":27730577457251,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be981df19674bc94d0448f966b3a20e85a6548eb_cc6d60a1-c6ae-452d-b60a-44abc8781803.webp?v=1783560840"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/be981df19674bc94d0448f966b3a20e85a6548eb_cc6d60a1-c6ae-452d-b60a-44abc8781803.webp?v=1783560840","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43883979440227,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"SST0118452-XU12","requires_shipping":true,"taxable":true,"featured_image":{"id":36225788674147,"product_id":7937809317987,"position":10,"created_at":"2026-07-09T09:33:54+08:00","updated_at":"2026-07-09T09:33:56+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/507a47ca2f3aab79b16c5cf10c2682a454ef8d47_854e02a0-3b95-4ac2-99db-22cde756dfc9.webp?v=1783560836","variant_ids":[43883979440227]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 獻出你的心臟! - Black","public_title":"Black","options":["Black"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST0118452-XU12","featured_media":{"alt":null,"id":27730574311523,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/507a47ca2f3aab79b16c5cf10c2682a454ef8d47_854e02a0-3b95-4ac2-99db-22cde756dfc9.webp?v=1783560836"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883979505763,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"SST01184O9-XU12","requires_shipping":true,"taxable":true,"featured_image":{"id":36225791033443,"product_id":7937809317987,"position":14,"created_at":"2026-07-09T09:33:57+08:00","updated_at":"2026-07-09T09:33:59+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f99dcc5e8821027b01ad88cc469e7c6edca8f98a_07ac8ce5-c04d-4c0a-9d68-8d5dfd97a969.webp?v=1783560839","variant_ids":[43883979505763]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 獻出你的心臟! - Cobalt Blue","public_title":"Cobalt Blue","options":["Cobalt Blue"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01184O9-XU12","featured_media":{"alt":null,"id":27730576638051,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f99dcc5e8821027b01ad88cc469e7c6edca8f98a_07ac8ce5-c04d-4c0a-9d68-8d5dfd97a969.webp?v=1783560839"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43883979538531,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"SST011840B-XU12","requires_shipping":true,"taxable":true,"featured_image":{"id":36225789100131,"product_id":7937809317987,"position":11,"created_at":"2026-07-09T09:33:55+08:00","updated_at":"2026-07-09T09:33:57+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b8a79fb6882af3fe465a878542ae93099dfa314_47482699-b8c4-4763-b64e-e8e39dd3c6cf.webp?v=1783560837","variant_ids":[43883979538531]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 獻出你的心臟! - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST011840B-XU12","featured_media":{"alt":null,"id":27730574737507,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b8a79fb6882af3fe465a878542ae93099dfa314_47482699-b8c4-4763-b64e-e8e39dd3c6cf.webp?v=1783560837"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43883979440227,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"SST0118452-XU12","requires_shipping":true,"taxable":true,"featured_image":{"id":36225788674147,"product_id":7937809317987,"position":10,"created_at":"2026-07-09T09:33:54+08:00","updated_at":"2026-07-09T09:33:56+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/507a47ca2f3aab79b16c5cf10c2682a454ef8d47_854e02a0-3b95-4ac2-99db-22cde756dfc9.webp?v=1783560836","variant_ids":[43883979440227]},"available":true,"name":"iPhone 12 mini SolidSuit 進擊的巨人 Attack on Titan 獻出你的心臟! - Black","public_title":"Black","options":["Black"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST0118452-XU12","featured_media":{"alt":null,"id":27730574311523,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/507a47ca2f3aab79b16c5cf10c2682a454ef8d47_854e02a0-3b95-4ac2-99db-22cde756dfc9.webp?v=1783560836"}},"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: "停產"
}