$product = {"id":7234898002019,"title":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 史迪奇 - 搞怪系列-怪可愛","handle":"iphone-13-mini-solidsuit-classic-magsafe-yf02","description":null,"published_at":"2024-03-18T11:28:06+08:00","created_at":"2024-03-18T11:03:44+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師SolidSuit MagSafe專區-史迪奇","tags":["20%","25%","30%","35%","40%","45%","50%","b2b","brand-Apple","designer","designer-stitch","device-iPhone 13 mini","merge","reseller-solidsuit-magsafe-stitch","Top50","type-Solidsuit MagSafe"],"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":41444777951331,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0122852-YF02","requires_shipping":true,"taxable":true,"featured_image":{"id":31086924005475,"product_id":7234898002019,"position":4,"created_at":"2024-03-18T11:03:54+08:00","updated_at":"2024-03-18T11:03:54+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79b43b9a6658589a65f226f5039f4cf88e7d31f6_5ec73983-e044-4ac7-bc95-60c95468495e.webp?v=1710731034","variant_ids":[41444777951331]},"available":true,"name":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 史迪奇 - 搞怪系列-怪可愛 - Black","public_title":"Black","options":["Black"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-YF02","featured_media":{"alt":null,"id":23467509547107,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79b43b9a6658589a65f226f5039f4cf88e7d31f6_5ec73983-e044-4ac7-bc95-60c95468495e.webp?v=1710731034"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41444778246243,"title":"Seaweed Green","option1":"Seaweed Green","option2":null,"option3":null,"sku":"MST01228Z8-YF02","requires_shipping":true,"taxable":true,"featured_image":{"id":31086931116131,"product_id":7234898002019,"position":16,"created_at":"2024-03-18T11:04:21+08:00","updated_at":"2024-03-18T11:04:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/43e4b9aed008ca1071a688c5d881a781e786a5db_edf125d7-484d-4c27-bf6f-90b8e6ce13b8.webp?v=1710731061","variant_ids":[41444778246243]},"available":true,"name":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 史迪奇 - 搞怪系列-怪可愛 - Seaweed Green","public_title":"Seaweed Green","options":["Seaweed Green"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z8-YF02","featured_media":{"alt":null,"id":23467516657763,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/43e4b9aed008ca1071a688c5d881a781e786a5db_edf125d7-484d-4c27-bf6f-90b8e6ce13b8.webp?v=1710731061"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e2310b83d1eef0571d4dd94668eb84c4c779297e_f8c86b46-a929-42b3-9cc2-0d9f993f7025.webp?v=1710731027","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f9a6aa7d866cc87864f0c2fec4b57866a2af25b4_0492c631-c7cd-4920-b30a-350015fafa94.webp?v=1710731029","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/57884c6b0e4cb84b1ccde484e64902ddca072683_8aa19f0a-b257-4b71-be11-8601e7776f6f.webp?v=1710731032","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79b43b9a6658589a65f226f5039f4cf88e7d31f6_5ec73983-e044-4ac7-bc95-60c95468495e.webp?v=1710731034","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14b8367b753d30a25b0aa1015a932c9a3dd33818_80970d7a-d7ed-4c06-a313-df0ce8d9ec58.webp?v=1710731036","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cae818a1a0ad704f3e07479c3ee561f451e4bdf6_3f8997eb-e6ec-47da-a950-7a62ffaab02d.webp?v=1710731038","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac242573144898a952ddf8e702e65bdb4e22bb94_8815eeb8-ce08-4ffb-b5bc-18160a41d905.webp?v=1710731041","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/349911e76f6a2cfeb12d0e8168c516e1010a0369_d1874b9b-92f9-43c4-9097-60e51575283c.webp?v=1710731043","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60abebed05d3298fdc6dcda9be9770a72b1c1cf6_fa41c90f-349e-413c-a882-371ffa76cb81.webp?v=1710731045","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/324cbc755b6353581cbbd10e60d06ce3cbd7e1dd_a08c4395-1ac9-430e-82fd-2de08a23e332.webp?v=1710731047","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de1ab434b62c09781784908c9cf6bd5c113623db_e5c30ce4-bc65-4a96-ade7-972ba1a59a0a.webp?v=1710731050","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec0cfec9ff3857e1441d12ce9d8a543ca5a9980d_cc80459a-3f60-464e-8553-23d19823ddff.webp?v=1710731052","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/451d47d375b22a1452b38f13244e0500b8e6f7f5_8ae27294-5eb8-4c8a-8407-5007269a5111.webp?v=1710731054","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7eaa7eb7d319a464d87a033c2b5f0924a13cddcb_0d755934-0003-4710-a1c5-9881e91542f9.webp?v=1710731056","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4ae118df6f9f3fea1beff1318a6139a495ff2e15_c528a6fc-0e64-4789-b7fb-782448e9a0fc.webp?v=1710731059","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/43e4b9aed008ca1071a688c5d881a781e786a5db_edf125d7-484d-4c27-bf6f-90b8e6ce13b8.webp?v=1710731061"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e2310b83d1eef0571d4dd94668eb84c4c779297e_f8c86b46-a929-42b3-9cc2-0d9f993f7025.webp?v=1710731027","options":["color"],"media":[{"alt":null,"id":23467508170851,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e2310b83d1eef0571d4dd94668eb84c4c779297e_f8c86b46-a929-42b3-9cc2-0d9f993f7025.webp?v=1710731027"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e2310b83d1eef0571d4dd94668eb84c4c779297e_f8c86b46-a929-42b3-9cc2-0d9f993f7025.webp?v=1710731027","width":2000},{"alt":null,"id":23467508564067,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f9a6aa7d866cc87864f0c2fec4b57866a2af25b4_0492c631-c7cd-4920-b30a-350015fafa94.webp?v=1710731029"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f9a6aa7d866cc87864f0c2fec4b57866a2af25b4_0492c631-c7cd-4920-b30a-350015fafa94.webp?v=1710731029","width":2000},{"alt":null,"id":23467509153891,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/57884c6b0e4cb84b1ccde484e64902ddca072683_8aa19f0a-b257-4b71-be11-8601e7776f6f.webp?v=1710731032"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/57884c6b0e4cb84b1ccde484e64902ddca072683_8aa19f0a-b257-4b71-be11-8601e7776f6f.webp?v=1710731032","width":2000},{"alt":null,"id":23467509547107,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79b43b9a6658589a65f226f5039f4cf88e7d31f6_5ec73983-e044-4ac7-bc95-60c95468495e.webp?v=1710731034"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79b43b9a6658589a65f226f5039f4cf88e7d31f6_5ec73983-e044-4ac7-bc95-60c95468495e.webp?v=1710731034","width":2000},{"alt":null,"id":23467510169699,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14b8367b753d30a25b0aa1015a932c9a3dd33818_80970d7a-d7ed-4c06-a313-df0ce8d9ec58.webp?v=1710731036"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14b8367b753d30a25b0aa1015a932c9a3dd33818_80970d7a-d7ed-4c06-a313-df0ce8d9ec58.webp?v=1710731036","width":2000},{"alt":null,"id":23467510595683,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cae818a1a0ad704f3e07479c3ee561f451e4bdf6_3f8997eb-e6ec-47da-a950-7a62ffaab02d.webp?v=1710731038"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cae818a1a0ad704f3e07479c3ee561f451e4bdf6_3f8997eb-e6ec-47da-a950-7a62ffaab02d.webp?v=1710731038","width":2000},{"alt":null,"id":23467511021667,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac242573144898a952ddf8e702e65bdb4e22bb94_8815eeb8-ce08-4ffb-b5bc-18160a41d905.webp?v=1710731041"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ac242573144898a952ddf8e702e65bdb4e22bb94_8815eeb8-ce08-4ffb-b5bc-18160a41d905.webp?v=1710731041","width":2000},{"alt":null,"id":23467511545955,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/349911e76f6a2cfeb12d0e8168c516e1010a0369_d1874b9b-92f9-43c4-9097-60e51575283c.webp?v=1710731043"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/349911e76f6a2cfeb12d0e8168c516e1010a0369_d1874b9b-92f9-43c4-9097-60e51575283c.webp?v=1710731043","width":2000},{"alt":null,"id":23467512365155,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60abebed05d3298fdc6dcda9be9770a72b1c1cf6_fa41c90f-349e-413c-a882-371ffa76cb81.webp?v=1710731045"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/60abebed05d3298fdc6dcda9be9770a72b1c1cf6_fa41c90f-349e-413c-a882-371ffa76cb81.webp?v=1710731045","width":2000},{"alt":null,"id":23467512922211,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/324cbc755b6353581cbbd10e60d06ce3cbd7e1dd_a08c4395-1ac9-430e-82fd-2de08a23e332.webp?v=1710731047"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/324cbc755b6353581cbbd10e60d06ce3cbd7e1dd_a08c4395-1ac9-430e-82fd-2de08a23e332.webp?v=1710731047","width":2000},{"alt":null,"id":23467513544803,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de1ab434b62c09781784908c9cf6bd5c113623db_e5c30ce4-bc65-4a96-ade7-972ba1a59a0a.webp?v=1710731050"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de1ab434b62c09781784908c9cf6bd5c113623db_e5c30ce4-bc65-4a96-ade7-972ba1a59a0a.webp?v=1710731050","width":2000},{"alt":null,"id":23467514069091,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec0cfec9ff3857e1441d12ce9d8a543ca5a9980d_cc80459a-3f60-464e-8553-23d19823ddff.webp?v=1710731052"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec0cfec9ff3857e1441d12ce9d8a543ca5a9980d_cc80459a-3f60-464e-8553-23d19823ddff.webp?v=1710731052","width":2000},{"alt":null,"id":23467514789987,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/451d47d375b22a1452b38f13244e0500b8e6f7f5_8ae27294-5eb8-4c8a-8407-5007269a5111.webp?v=1710731054"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/451d47d375b22a1452b38f13244e0500b8e6f7f5_8ae27294-5eb8-4c8a-8407-5007269a5111.webp?v=1710731054","width":2000},{"alt":null,"id":23467515412579,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7eaa7eb7d319a464d87a033c2b5f0924a13cddcb_0d755934-0003-4710-a1c5-9881e91542f9.webp?v=1710731056"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7eaa7eb7d319a464d87a033c2b5f0924a13cddcb_0d755934-0003-4710-a1c5-9881e91542f9.webp?v=1710731056","width":2000},{"alt":null,"id":23467516100707,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4ae118df6f9f3fea1beff1318a6139a495ff2e15_c528a6fc-0e64-4789-b7fb-782448e9a0fc.webp?v=1710731059"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4ae118df6f9f3fea1beff1318a6139a495ff2e15_c528a6fc-0e64-4789-b7fb-782448e9a0fc.webp?v=1710731059","width":2000},{"alt":null,"id":23467516657763,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/43e4b9aed008ca1071a688c5d881a781e786a5db_edf125d7-484d-4c27-bf6f-90b8e6ce13b8.webp?v=1710731061"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/43e4b9aed008ca1071a688c5d881a781e786a5db_edf125d7-484d-4c27-bf6f-90b8e6ce13b8.webp?v=1710731061","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":41444777951331,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0122852-YF02","requires_shipping":true,"taxable":true,"featured_image":{"id":31086924005475,"product_id":7234898002019,"position":4,"created_at":"2024-03-18T11:03:54+08:00","updated_at":"2024-03-18T11:03:54+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79b43b9a6658589a65f226f5039f4cf88e7d31f6_5ec73983-e044-4ac7-bc95-60c95468495e.webp?v=1710731034","variant_ids":[41444777951331]},"available":true,"name":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 史迪奇 - 搞怪系列-怪可愛 - Black","public_title":"Black","options":["Black"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-YF02","featured_media":{"alt":null,"id":23467509547107,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79b43b9a6658589a65f226f5039f4cf88e7d31f6_5ec73983-e044-4ac7-bc95-60c95468495e.webp?v=1710731034"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41444778246243,"title":"Seaweed Green","option1":"Seaweed Green","option2":null,"option3":null,"sku":"MST01228Z8-YF02","requires_shipping":true,"taxable":true,"featured_image":{"id":31086931116131,"product_id":7234898002019,"position":16,"created_at":"2024-03-18T11:04:21+08:00","updated_at":"2024-03-18T11:04:21+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/43e4b9aed008ca1071a688c5d881a781e786a5db_edf125d7-484d-4c27-bf6f-90b8e6ce13b8.webp?v=1710731061","variant_ids":[41444778246243]},"available":true,"name":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 史迪奇 - 搞怪系列-怪可愛 - Seaweed Green","public_title":"Seaweed Green","options":["Seaweed Green"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z8-YF02","featured_media":{"alt":null,"id":23467516657763,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/43e4b9aed008ca1071a688c5d881a781e786a5db_edf125d7-484d-4c27-bf6f-90b8e6ce13b8.webp?v=1710731061"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":41444777951331,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0122852-YF02","requires_shipping":true,"taxable":true,"featured_image":{"id":31086924005475,"product_id":7234898002019,"position":4,"created_at":"2024-03-18T11:03:54+08:00","updated_at":"2024-03-18T11:03:54+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79b43b9a6658589a65f226f5039f4cf88e7d31f6_5ec73983-e044-4ac7-bc95-60c95468495e.webp?v=1710731034","variant_ids":[41444777951331]},"available":true,"name":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 史迪奇 - 搞怪系列-怪可愛 - Black","public_title":"Black","options":["Black"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-YF02","featured_media":{"alt":null,"id":23467509547107,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/79b43b9a6658589a65f226f5039f4cf88e7d31f6_5ec73983-e044-4ac7-bc95-60c95468495e.webp?v=1710731034"}},"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: "停產" }