我遇到了一点麻烦。我正在重新设计我的商店,并尝试改变变体下拉菜单在前端的显示方式。据我所知,option_selection.js 是一个从 Shopifys 服务器托管和加载的全局资产,它改变了我的产品选项在我的主题中的显示方式。
目前,它提供了两个下拉菜单,其中包含我设置的两个输卵管选项。我想要的是在下拉列表中选项标题旁边显示产品价格。
At the moment it looks like this...
![enter image description here](https://i.stack.imgur.com/cTPzz.png)
I would like it to look like this...
![enter image description here](https://i.stack.imgur.com/sjQ4B.jpg)
Or better still have the +/- price modifier like this...
![enter image description here](https://i.stack.imgur.com/b4Lg7.jpg)
不幸的是我不知道如何处理这个问题。模板代码似乎被设置为显示价格,但我猜测它被 option_selection.js 覆盖
这是模板代码:
<select name="id" id="productSelect" class="product-variants trees">
{% for variant in product.variants %}
{% if variant.available %}
<option {% if variant == product.selected_or_first_available_variant %} selected="selected" {% endif %} value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money_with_currency }}</option>
{% else %}
<option disabled="disabled">
{{ variant.title }} - Sold out
</option>
{% endif %}
{% endfor %}
</select>
我在 Shopify 论坛中询问过,但他们似乎已经死了。
- 制作您自己的 option_selection.js 并将该文件上传到主题中的资产文件夹中。
-
在您的主题文件(可能是 templates/product.liquid)中找到这一行。
{{ 'option_selection.js' | shopify_asset_url | script_tag }}
-
注释该行并在其下方添加此代码。
{{ 'new_option_selection.js' | asset_url | script_tag }}
希望有帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)