zz-shopify-components 0.12.0 → 0.12.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,329 @@
1
+ {% schema %}
2
+ {
3
+ "name": "Product Buy Now",
4
+ "settings": [
5
+ {
6
+ "type": "color",
7
+ "id": "bg_color",
8
+ "default": "#ffffff",
9
+ "label": "背景色"
10
+ },
11
+ {
12
+ "type": "header",
13
+ "content": "Price Settings"
14
+ },
15
+ {
16
+ "type": "checkbox",
17
+ "id": "show_basic_price",
18
+ "label": "是否显示为基础价格 + 套餐附加价格 (注意开启时要在对应基础变体元字段设置 basic 为 true)",
19
+ "default": false
20
+ },
21
+ {
22
+ "type": "select",
23
+ "id": "discount_type",
24
+ "label": "购买区折扣展示类型",
25
+ "options": [
26
+ { "value": "percent", "label": "折扣百分比" },
27
+ { "value": "price", "label": "折扣价格" }
28
+ ],
29
+ "default": "percent"
30
+ },
31
+ {
32
+ "type": "select",
33
+ "id": "bar_discount_type",
34
+ "label": "底部Bar折扣展示类型",
35
+ "options": [
36
+ { "value": "percent", "label": "折扣百分比" },
37
+ { "value": "price", "label": "折扣价格" }
38
+ ],
39
+ "default": "percent"
40
+ },
41
+ {
42
+ "type": "header",
43
+ "content": "Main Settings"
44
+ },
45
+ {
46
+ "type": "text",
47
+ "id": "title",
48
+ "label": "Title"
49
+ },
50
+
51
+ {
52
+ "type": "textarea",
53
+ "id": "desc",
54
+ "label": "Description"
55
+ },
56
+ {
57
+ "type": "textarea",
58
+ "id": "features",
59
+ "label": "Features"
60
+ },
61
+ {
62
+ "type": "text",
63
+ "id": "bar_title",
64
+ "label": "Bar Title"
65
+ },
66
+ {
67
+ "type": "textarea",
68
+ "id": "bar_desc",
69
+ "label": "Bar Description"
70
+ },
71
+ {
72
+ "type": "header",
73
+ "content": "购买按钮配置"
74
+ },
75
+ {
76
+ "type": "text",
77
+ "id": "bar_btn",
78
+ "label": "Buy Now Button Text"
79
+ },
80
+ {
81
+ "type": "text",
82
+ "id": "bar_btn_out_of_stock",
83
+ "label": "Add to Cart Button Text (Out of Stock)"
84
+ },
85
+ ],
86
+ "blocks": [
87
+ {
88
+ "type": "@app"
89
+ },
90
+ {
91
+ "type": "rating",
92
+ "name": "t:sections.main-product.blocks.rating.name",
93
+ "limit": 1,
94
+ "settings": [
95
+ {
96
+ "type": "paragraph",
97
+ "content": "t:sections.main-product.blocks.rating.settings.paragraph.content"
98
+ }
99
+ ]
100
+ },
101
+ {
102
+ "name": "Swiper Image",
103
+ "type": "image",
104
+ "settings": [
105
+ {
106
+ "type": "image_picker",
107
+ "id": "img",
108
+ "label": "Image",
109
+ "info": "轮播图片"
110
+ },
111
+ {
112
+ "type": "image_picker",
113
+ "id": "img_mb",
114
+ "label": "Mobile Image",
115
+ "info": "轮播图片(移动端)"
116
+ },
117
+ {
118
+ "type": "text",
119
+ "id": "alt",
120
+ "label": "Alt",
121
+ "info": "轮播图片 Alt 属性"
122
+ }
123
+ ]
124
+ },
125
+ {
126
+ "type": "custom_liquid",
127
+ "name": "t:sections.custom-liquid.name",
128
+ "settings": [
129
+ {
130
+ "type": "liquid",
131
+ "id": "custom_liquid",
132
+ "label": "t:sections.custom-liquid.settings.custom_liquid.label",
133
+ "info": "t:sections.custom-liquid.settings.custom_liquid.info"
134
+ }
135
+ ]
136
+ }
137
+ ],
138
+ "presets": [
139
+ {
140
+ "name": "Product Buy Now"
141
+ }
142
+ ]
143
+ }
144
+ {% endschema %}
145
+
146
+ {{ 'component-rating.css' | asset_url | stylesheet_tag }}
147
+
148
+ {% assign swiper_blocks = section.blocks | where: 'type', 'image' %}
149
+
150
+
151
+ <div class='product-buy-section tw-max-w-[1680px] tw-w-full tw-pb-[60px] lg:tw-px-[24px] tw-mx-auto lg:tw-grid tw-grid-cols-12 tw-gap-20 '>
152
+ {% comment %} 左侧 轮播 {% endcomment %}
153
+ <div class=' tw-col-span-8 tw-relative'>
154
+ <div class=' tw-sticky tw-top-[64px]' style=''>
155
+ {% render 'zz-buy-swiper', blocks: swiper_blocks %}
156
+ </div>
157
+ </div>
158
+ {% comment %} 右侧 {% endcomment %}
159
+ <div class='tw-col-span-4 tw-px-[24px] max-lg:tw-mt-[24px] tw-flex tw-flex-col '>
160
+ {% comment %} 标题 | 描述 | 特性 {% endcomment %}
161
+ <h1 class='lg:tw-text-[30px] max-lg:tw-text-[24px] tw-font-semibold'>
162
+ {{ section.settings.title }}
163
+ </h1>
164
+ <p class='tw-text-[#333] tw-text-[14px]'>{{ section.settings.desc }}</p>
165
+ {% for block in section.blocks %}
166
+ {%- case block.type -%}
167
+ {%- when '@app' -%}
168
+ {% render block %}
169
+ {%- when 'rating' -%}
170
+ {%- if product.metafields.reviews.rating.value != blank -%}
171
+ {% liquid
172
+ assign rating_decimal = 0
173
+ assign decimal = product.metafields.reviews.rating.value.rating | modulo: 1
174
+ if decimal >= 0.3 and decimal <= 0.7
175
+ assign rating_decimal = 0.5
176
+ elsif decimal > 0.7
177
+ assign rating_decimal = 1
178
+ endif
179
+ %}
180
+ <div
181
+ class='rating'
182
+ role='img'
183
+ aria-label='{{ 'accessibility.star_reviews_info' | t: rating_value: product.metafields.reviews.rating.value, rating_max: product.metafields.reviews.rating.value.scale_max }}'
184
+ >
185
+ <span
186
+ aria-hidden='true'
187
+ class='rating-star'
188
+ style='--rating: {{ product.metafields.reviews.rating.value.rating | floor }}; --rating-max: {{ product.metafields.reviews.rating.value.scale_max }}; --rating-decimal: {{ rating_decimal }};'
189
+ ></span>
190
+ </div>
191
+ <p class='rating-text caption'>
192
+ <span aria-hidden='true'>
193
+ {{- product.metafields.reviews.rating.value }} /
194
+ {{ product.metafields.reviews.rating.value.scale_max -}}
195
+ </span>
196
+ </p>
197
+ <p class='rating-count caption'>
198
+ <span aria-hidden='true'
199
+ >({{ product.metafields.reviews.rating_count }})</span
200
+ >
201
+ <span class='visually-hidden'>
202
+ {{- product.metafields.reviews.rating_count }}
203
+ {{ 'accessibility.total_reviews' | t -}}
204
+ </span>
205
+ </p>
206
+ {%- endif -%}
207
+ {%- endcase -%}
208
+ {% endfor %}
209
+ {% if section.settings.features != blank %}
210
+ <div class=' tw-bg-[#F6F6F6] tw-flex tw-p-10 tw-rounded-[12px] tw-mt-[30px]'>
211
+ <svg
212
+ width='30'
213
+ height='30'
214
+ viewBox='0 0 20 20'
215
+ fill='none'
216
+ xmlns='http://www.w3.org/2000/svg'
217
+ >
218
+ <path d="M8.14902 4.44446H5.67988C4.99805 4.44446 4.44531 4.99719 4.44531 5.67903V8.14816M8.14902 15.5556H5.67988C4.99805 15.5556 4.44531 15.0028 4.44531 14.321V11.8519M11.8527 4.44446H14.3219C15.0037 4.44446 15.5564 4.99719 15.5564 5.67903V8.14816M15.5564 11.8519V14.321C15.5564 15.0028 15.0037 15.5556 14.3219 15.5556H11.8527M8.61198 12.0833H11.3898C11.7733 12.0833 12.0842 11.7724 12.0842 11.3889V8.61112C12.0842 8.22759 11.7733 7.91668 11.3898 7.91668H8.61198C8.22845 7.91668 7.91753 8.22759 7.91753 8.61112V11.3889C7.91753 11.7724 8.22845 12.0833 8.61198 12.0833Z" stroke="black" stroke-linecap="round"/>
219
+ </svg>
220
+ <p class=' tw-pl-7 tw-whitespace-pre tw-text-[12px] tw-leading-[1.75]'>
221
+ {{- section.settings.features -}}
222
+ </p>
223
+ </div>
224
+ {% endif %}
225
+ {% comment %} 产品变体 {% endcomment %}
226
+ <div class='tw-mt-[30px]'>
227
+ {% render 'zz-product-buy-now-select',
228
+ name: section.settings.title,
229
+ blocks: section.blocks,
230
+ show_basic: section.settings.show_basic_price,
231
+ discount_type: section.settings.discount_type,
232
+ basic_title: section.settings.basic_title
233
+ %}
234
+ </div>
235
+ <div class='tw-mt-[30px]'>
236
+ {% render 'zz-product-buy-now-counter' %}
237
+ </div>
238
+
239
+ {% for block in section.blocks %}
240
+ {% if block.type == 'custom_liquid' %}
241
+ {{ block.settings.custom_liquid }}
242
+ {% endif %}
243
+ {% endfor %}
244
+ </div>
245
+ </div>
246
+ {% render 'zz-buy-now-bottom-bar',
247
+ title: section.settings.bar_title,
248
+ desc: section.settings.bar_desc,
249
+ btn: section.settings.bar_btn,
250
+ btn_out_of_stock: section.settings.bar_btn_out_of_stock,
251
+ product_title: section.settings.title,
252
+ discount_type: section.settings.bar_discount_type,
253
+ %}
254
+
255
+
256
+ <style>
257
+ #shopify-section-{{ section.id }} h1,
258
+ #shopify-section-{{ section.id }} p {
259
+ margin: 0;
260
+ color: #000;
261
+ }
262
+ #shopify-section-{{ section.id }} .product-counter,
263
+ #shopify-section-{{ section.id }} select
264
+ {
265
+ background-color: #fff !important;
266
+ }
267
+ #shopify-section-{{ section.id }} {
268
+ background-color: {{ section.settings.bg_color }};
269
+ }
270
+
271
+ #shopify-section-{{ section.id }} .product-buy-now-bottom-bar-button {
272
+ background: linear-gradient(139.02deg, #FFEB00 0.01%, #FFD400 100.55%);
273
+ color: #000;
274
+
275
+ }
276
+ #shopify-section-{{ section.id }} .product-version-option:has(input[type='radio']:checked) {
277
+ border-color: #FFD400;
278
+ }
279
+ body {
280
+ background: #fff;
281
+ padding-bottom: 160px !important;
282
+ }
283
+ </style>
284
+ <script defer src='{{ 'zz-product-buy-now-select.js' | asset_url }}'></script>
285
+
286
+ <script type='application/ld+json'>
287
+ {
288
+ "@context": "http://schema.org/",
289
+ "@type": "Product",
290
+ "name": {{ product.title | json }},
291
+ "url": {{ request.origin | append: product.url | json }},
292
+ {% if seo_media -%}
293
+ "image": [
294
+ {{ seo_media | image_url: width: 1920 | prepend: "https:" | json }}
295
+ ],
296
+ {%- endif %}
297
+ "description": {{ product.description | strip_html | json }},
298
+ {% if product.selected_or_first_available_variant.sku != blank -%}
299
+ "sku": {{ product.selected_or_first_available_variant.sku | json }},
300
+ {%- endif %}
301
+ "brand": {
302
+ "@type": "Brand",
303
+ "name": {{ product.vendor | json }}
304
+ },
305
+ "offers": [
306
+ {%- for variant in product.variants -%}
307
+ {
308
+ "@type" : "Offer",
309
+ {%- if variant.sku != blank -%}
310
+ "sku": {{ variant.sku | json }},
311
+ {%- endif -%}
312
+ {%- if variant.barcode.size == 12 -%}
313
+ "gtin12": {{ variant.barcode }},
314
+ {%- endif -%}
315
+ {%- if variant.barcode.size == 13 -%}
316
+ "gtin13": {{ variant.barcode }},
317
+ {%- endif -%}
318
+ {%- if variant.barcode.size == 14 -%}
319
+ "gtin14": {{ variant.barcode }},
320
+ {%- endif -%}
321
+ "availability" : "http://schema.org/{% if variant.available %}InStock{% else %}OutOfStock{% endif %}",
322
+ "price" : {{ variant.price | divided_by: 100.00 | json }},
323
+ "priceCurrency" : {{ cart.currency.iso_code | json }},
324
+ "url" : {{ request.origin | append: variant.url | json }}
325
+ }{% unless forloop.last %},{% endunless %}
326
+ {%- endfor -%}
327
+ ]
328
+ }
329
+ </script>
@@ -0,0 +1,77 @@
1
+ {% comment %}
2
+ 按钮配置选项:
3
+ type:按钮类型
4
+ - primary:主要按钮
5
+ - default:默认按钮
6
+ - link:链接按钮
7
+
8
+ shape: 按钮形状
9
+ - default:默认
10
+ - round:圆角
11
+
12
+ color:按钮颜色
13
+ - black:黑色
14
+ - white:白色
15
+ - orange:橙色
16
+
17
+ size:按钮尺寸
18
+ - large:大号
19
+ - medium:中号(默认)
20
+ - small:小号
21
+
22
+ 其他参数:
23
+ - href:链接地址
24
+ - backdrop_filter:毛玻璃效果 true/false
25
+ - icon:图标名称
26
+ - text:按钮文字
27
+ - class_name:自定义类名
28
+ {% endcomment %}
29
+
30
+ {% assign btn_type = type | default: 'primary' %}
31
+ {% assign btn_color = color | default: 'black' %}
32
+ {% assign btn_size = size | default: 'medium' %}
33
+ {% assign icon_size = icon_size | default: 15 %}
34
+ {% assign width = width | default: 'auto' %}
35
+
36
+ <style>
37
+ .zz-btn-icon {
38
+ display: flex;
39
+ }
40
+ </style>
41
+
42
+ {% if href %}
43
+ {% if btn_type == 'link' %}
44
+ <a href="{{ href | default: '#' }}" {% if btn_id != blank %} id="{{ btn_id }}" {% endif %} class="zz-btn-link tw-text-[#378DDD] tw-inline-flex tw-items-center tw-text-[12px] lg:tw-text-[14px] tw-no-underline zz-btn-link-{{ btn_size }} {% if width == 'full' %} tw-w-full {% endif %} {{ class_name }}">
45
+ <span class="zz-btn-text">{{ text }}</span>
46
+ {% if postfix_icon %}<span class="zz-btn-icon" style="margin-left: {{ icon_left_margin }}px; margin-right: {{ icon_right_margin }}px;">
47
+ {% render 'zz-icon', icon_name: postfix_icon, icon_size: icon_size %}
48
+ </span>{% endif %}
49
+ </a>
50
+ {% else %}
51
+ <a
52
+ href="{{ href | default: '#' }}"
53
+ {% if btn_id != blank %} id="{{ btn_id }}" {% endif %}
54
+ class="zz-btn zz-btn-{{ btn_type }} zz-btn-{{ btn_color }} zz-btn-shape-{{ shape }} zz-btn-{{ btn_size }} {% if width == 'full' %} tw-w-full {% endif %} {{ class_name }}"
55
+ {% if backdrop_filter %}
56
+ style="backdrop-filter: blur(12px);background: #FFFFFF0F;"
57
+ {% endif %}
58
+ >
59
+ {% if icon %}<span class="zz-btn-icon">{{ icon }}</span>{% endif %}
60
+ <span class="zz-btn-text">{{ text }}</span>
61
+ </a>
62
+ {% endif %}
63
+
64
+ {% else %}
65
+
66
+ <button
67
+ class="zz-btn zz-btn-{{ btn_type }} zz-btn-{{ btn_color }} zz-btn-shape-{{ shape }} zz-btn-{{ btn_size }} {% if width == 'full' %} tw-w-full {% endif %} {{ width }} {{ class_name }}"
68
+ {% if modal_id != blank %} data-zz-modal-target="#{{ modal_id }}" {% endif %}
69
+ {% if btn_id != blank %} id="{{ btn_id }}" {% endif %}
70
+ {% if backdrop_filter %}
71
+ style="backdrop-filter: blur(12px);background: #FFFFFF0F;"
72
+ {% endif %}
73
+ >
74
+ {% if icon %}<span class="zz-btn-icon">{{ icon }}</span>{% endif %}
75
+ <span class="zz-btn-text">{{ text }}</span>
76
+ </button>
77
+ {% endif %}
@@ -0,0 +1,163 @@
1
+ {% comment %} Products {% endcomment %}
2
+ {% assign is_edu_product = false %}
3
+ {% if product.tags contains 'edu-product' %}
4
+ {% assign is_edu_product = true %}
5
+ {% endif %}
6
+
7
+ {% assign is_logged_in = false %}
8
+ {% assign is_edu_verified = false %}
9
+ {% if customer %}
10
+ {% assign is_logged_in = true %}
11
+ {% if customer.tags contains 'edu-verified' %}
12
+ {% assign is_edu_verified = true %}
13
+ {% endif %}
14
+ {% endif %}
15
+
16
+
17
+ <buy-now-bottom-bar
18
+ data-currency='{{ cart.currency.symbol }}'
19
+ data-btn-text='{{ btn }}'
20
+ data-discount-type='{{ discount_type }}'
21
+ data-btn-out-of-stock-text='{{ btn_out_of_stock }}'
22
+ data-care-guide='{{ care_guide_type }}'
23
+ data-is-edu-product='{{ is_edu_product }}'
24
+ data-is-logged-in='{{ is_logged_in }}'
25
+ data-is-edu-verified='{{ is_edu_verified }}'
26
+ data-edu-page-url='{{ shop.metafields.custom.edu_home_page.value.url }}'
27
+ class=' tw-left-0 tw-right-0 tw-max-w-screen tw-bg-white tw-bottom-0 tw-z-50 !tw-fixed buy-now-bottom-bar'
28
+ >
29
+ <div class=' tw-h-full tw-max-w-[1660px] tw-mx-auto tw-px-[12px] md:tw-px-[24px] tw-py-[8px] max-md:tw-pb-[18px] tw-flex md:tw-items-center tw-justify-between max-md:tw-flex-col max-md:tw-items-start'>
30
+ <div class=' tw-flex tw-flex-col tw-grow'>
31
+ <div class=' md:tw-hidden tw-flex tw-items-center tw-space-x-3'>
32
+ <span class='mb_price !tw-text-[20px] tw-font-semibold'>
33
+ {{-
34
+ product.selected_or_first_available_variant.price
35
+ | money_without_trailing_zeros
36
+ -}}
37
+ </span>
38
+ <span class='mb_before !tw-text-[14px] tw-text-[rgba(0,0,0,0.3)] tw-font-medium tw-line-through '>
39
+ {% if product.selected_or_first_available_variant.compare_at_price
40
+ > product.selected_or_first_available_variant.price
41
+ %}
42
+ {{
43
+ product.selected_or_first_available_variant.compare_at_price
44
+ | money_without_trailing_zeros
45
+ }}
46
+ {% endif %}
47
+ </span>
48
+ {% render 'zz-price-discouter',
49
+ before: product.selected_or_first_available_variant.compare_at_price,
50
+ after: product.selected_or_first_available_variant.price,
51
+ discount_type: discount_type
52
+ %}
53
+ </div>
54
+ <div class='bar-title-desc max-md:tw-mb-[12px]'>
55
+ <span class=' tw-font-semibold max-lg:tw-text-[12px] tw-text-[16px]'>
56
+ {{- title -}}
57
+ </span>
58
+ {% if desc != blank %}
59
+ <div class=' tw-flex tw-items-center '>
60
+ <span class=' tw-text-[12px] bar-tip tw-max-h-[16px] lg:tw-text-[14px] tw-leading-[1.25] tw-text-[#808080] tw-font-medium'>
61
+ {{- desc -}}
62
+ </span>
63
+ <svg
64
+ width='16'
65
+ height='16'
66
+ class='tw-flex-shrink-0 show-more-btn lg:tw-hidden'
67
+ viewBox='0 0 14 14'
68
+ fill='none'
69
+ xmlns='http://www.w3.org/2000/svg'
70
+ >
71
+ <path d="M3.03906 5.59998L6.99886 9.55977L10.9587 5.59998" stroke="black" stroke-opacity="0.5" stroke-linecap="round" stroke-linejoin="round"/>
72
+ </svg>
73
+ </div>
74
+ {% endif %}
75
+ </div>
76
+ </div>
77
+ <div class='tw-shrink-0 tw-flex tw-justify-end tw-items-center md:tw-space-x-8 tw-h-[44px] md:tw-h-[56px] max-md:tw-w-full '>
78
+ <div class=' max-md:tw-hidden lg:tw-min-w-[300px] md:tw-min-w-[200px]'>
79
+ <div class='tw-flex tw-items-center tw-space-x-3'>
80
+ <span class='price !tw-text-[20px] tw-font-semibold'>
81
+ {{-
82
+ product.selected_or_first_available_variant.price
83
+ | money_without_trailing_zeros
84
+ -}}
85
+ </span>
86
+ {% if product.selected_or_first_available_variant.compare_at_price
87
+ > product.selected_or_first_available_variant.price
88
+ %}
89
+ <span class='before !tw-text-[16px] tw-text-[rgba(0,0,0,0.3)] tw-font-medium tw-line-through '>
90
+ {{
91
+ product.selected_or_first_available_variant.compare_at_price
92
+ | money_without_trailing_zeros
93
+ }}
94
+ </span>
95
+ {% endif %}
96
+ {% render 'zz-price-discouter',
97
+ before: product.selected_or_first_available_variant.compare_at_price,
98
+ after: product.selected_or_first_available_variant.price,
99
+ discount_type: discount_type
100
+ %}
101
+ </div>
102
+ {% if has_installment %}
103
+ <div
104
+ class='paypal product-buy-paypal max-md:tw-hidden !tw-max-h-[20px] tw-overflow-hidden'
105
+ data-pp-buyercountry='US'
106
+ data-pp-message
107
+ data-pp-style-layout='text'
108
+ data-pp-style-logo-type='inline'
109
+ data-pp-style-text-color='black'
110
+ data-pp-style-text-size='11'
111
+ data-pp-amount='{{ product.selected_or_first_available_variant.price | money_without_currency | remove: ',' }}'
112
+ data-pp-placement='product'
113
+ ></div>
114
+ {% endif %}
115
+ </div>
116
+ <button class='product-buy-now-bottom-bar-button tw-flex tw-items-center tw-justify-center tw-border-none tw-h-full tw-text-[14px] md:tw-px-[51px] md:tw-py-[20px] max-md:tw-py-[15px] max-md:tw-w-full tw-rounded-full tw-font-semibold min-md:tw-text-[16px] {{ button_class }}'>
117
+ <span
118
+ class='buy-loading tw-hidden tw-daisy-loading tw-daisy-loading-spinner '
119
+ ></span>
120
+ <span class='buy-bottom-bar-btn-text'>
121
+ {{ btn }}
122
+ </span>
123
+ </button>
124
+ </div>
125
+ </div>
126
+
127
+ </buy-now-bottom-bar>
128
+
129
+
130
+ <script defer src='{{ 'zz-buy-now-product-bar.js' | asset_url }}'></script>
131
+ <style>
132
+ .buy-now-bottom-bar {
133
+ box-shadow: 0 -2px 3px rgba(0, 0, 0, 0.03); /* 创建上边框阴影 */
134
+ }
135
+ buy-now-bottom-bar .paypal {
136
+ max-height: 20px !important;
137
+ }
138
+ .bar-tip {
139
+ display: -webkit-box;
140
+ -webkit-box-orient: vertical;
141
+ overflow: hidden;
142
+ -webkit-line-clamp: 1; /* 默认行数 */
143
+ }
144
+
145
+ .show-more-desc {
146
+ -webkit-line-clamp: 3;
147
+ max-height: 48px; /* 根据行高设置 */
148
+ }
149
+
150
+ .buy-now-bottom-bar button {
151
+ transition: transform 0.2s ease;
152
+ }
153
+
154
+ .buy-now-bottom-bar button[disabled] {
155
+ opacity: 0.5;
156
+ }
157
+
158
+ @media (min-width: 750px) {
159
+ .buy-now-bottom-bar button:not([disabled]):hover {
160
+ transform: scale(1.05);
161
+ }
162
+ }
163
+ </style>
@@ -0,0 +1,107 @@
1
+ <div
2
+ class='
3
+ {% if option_name == 'Color' %}
4
+ tw-grid tw-grid-cols-2 tw-gap-6
5
+ {% else %}
6
+ tw-space-y-[16px]
7
+ {% endif %}
8
+ '
9
+ >
10
+ {% for option_value in values %}
11
+ <label
12
+ data-variant-id='{{ option_value.variant.id }}'
13
+ data-product-url='{{ product.url }}'
14
+ data-section-id='{{ section.id }}'
15
+ data-variant-name='{{ option_value.name }}'
16
+ class='product-normal-option tw-cursor-pointer tw-border-[#DDDDDD] tw-block tw-border tw-border-solid tw-rounded-[12px] tw-p-[20px]'
17
+ >
18
+ <input
19
+ type='radio'
20
+ name='{{ option_name }}'
21
+ class=' tw-sr-only'
22
+ value='{{ option_value | escape }}'
23
+ {% if option_value.selected %}
24
+ checked
25
+ {% endif %}
26
+ >
27
+ {%- assign name = 'option' | append: position -%}
28
+
29
+ <!-- 根据当前选项值查找basic=true的变体(basic版本) -->
30
+ {%- assign variant_for_value = null -%}
31
+ {%- assign current_option_value = option_value -%}
32
+
33
+ {%- for variant in product.variants -%}
34
+ {%- if variant.metafields.custom.basic == true
35
+ and variant.options contains option_value.name
36
+ -%}
37
+ {%- assign variant_for_value = variant -%}
38
+ {%- break -%}
39
+ {%- endif -%}
40
+ {%- endfor -%}
41
+
42
+ {%- unless variant_for_value -%}
43
+ {%- assign variant_for_value = product.variants
44
+ | where: 'id', option_value.variant.id
45
+ | first
46
+ -%}
47
+ {%- endunless -%}
48
+
49
+ {% comment %} 产品示例图 {% endcomment %}
50
+ <div
51
+ class='
52
+ {% if option_name == 'Color' %}
53
+ tw-flex tw-flex-col tw-space-y-6
54
+ {% else %}
55
+ tw-flex tw-space-x-[24px]
56
+ {% endif %}
57
+ '
58
+ >
59
+ {% if option_name == 'Color' %}
60
+ <div
61
+ class=' tw-w-[28px] tw-h-[28px] tw-rounded-full !tw-block {% if option.value != 'Black' %} tw-border-[1.5px] {% endif %} tw-border-[#d9d9d9]'
62
+ style='background: {{ option_value.name }}'
63
+ ></div>
64
+ <div class='tw-flex tw-flex-col tw-justify-center tw-space-y-[4px]'>
65
+ <h3 class=' tw-text-[16px] tw-font-semibold !tw-my-0'>
66
+ {{ option_value.name }}
67
+ </h3>
68
+ </div>
69
+
70
+ {% else %}
71
+ {{
72
+ variant_for_value.image
73
+ | image_url: height: 300, width: 300
74
+ | image_tag:
75
+ alt: option_value.alt,
76
+ preload: true,
77
+ class: 'tw-w-[80px] tw-h-[80px] tw-rounded-[10px]'
78
+ }}
79
+ <div class='tw-flex tw-flex-col tw-justify-center tw-space-y-[4px]'>
80
+ <h3 class=' tw-text-[16px] tw-font-semibold !tw-my-0'>
81
+ {{ option_value.name }}
82
+ </h3>
83
+ </div>
84
+
85
+ {%- if show_basic -%}
86
+ <div class='!tw-ml-auto tw-flex tw-items-center'>
87
+ <span class='tw-text-[16px] tw-font-medium'>
88
+ {{ variant_for_value.price | money }}
89
+ </span>
90
+ </div>
91
+ {%- endif -%}
92
+ {% endif %}
93
+ </div>
94
+ </label>
95
+ {% endfor %}
96
+ </div>
97
+
98
+ <style>
99
+ #product-buy-selector .deivide {
100
+ display: contents;
101
+ }
102
+
103
+ .product-normal-option:has(input[type='radio']:checked) {
104
+ border-color: #fc6c0f;
105
+ border-width: 1.5px;
106
+ }
107
+ </style>