我正在尝试删除某些产品类别的“添加到购物车”按钮。有没有办法在产品页面上运行脚本以获取类别面包屑并使用它来确定“添加到购物车”按钮是否可见?
这是 Lightspeed 商业中的代码:
<form action="{{ ('cart/add/' ~ product.vid) | url }}" id="product_configure_form" method="post">
{% if product.options or product.variants or product.custom %}
<div class="product-option row">
<div class="col-md-12">
{{ product | html_product_configure | raw }}
</div>
</div>
{% else %}
<input type="hidden" name="bundle_id" id="product_configure_bundle_id" value="">
{% endif %}
<div class="product-price row">
<div class="price-wrap col-xs-5 col-md-5">
{% if product.price.price_old %}
<span class="old-price">{{ product.price.price_old | money }}{% if shop.settings.legal.mode == 'strict' %} {{ 'SRP' | t }}{% endif %}</span>
{% endif %}
<span class="price">{{ product.price.price | money }}{% if shop.settings.legal.mode == 'strict' %} <small>*</small>{% endif %}</span>
{% if shop.b2b %}<small class="price-tax">{{ 'Excl. VAT' | t }}</small>{% else %}<small class="price-tax">{{ 'Incl. VAT' | t }}</small>{% endif %}
</div>
<div class="cart col-xs-7 col-md-7">
<div class="cart">
{% if product.stock.available %}
<input type="text" name="quantity" value="{{ product.quantity }}" />
<div class="change">
<a href="javascript:;" onclick="updateQuantity('up');" class="up">+</a>
<a href="javascript:;" onclick="updateQuantity('down');" class="down">-</a>
</div>
<a href="javascript:;" onclick="$('#product_configure_form').submit();" class="btn glyphicon glyphicon-shopping-cart" title="{{ 'Add to cart' | t }}" {% if shop.language == 'de' %}style="padding: 0px 10px;"{% endif %}>
<span>{{ 'Add to cart' | t }}</span>
</a>
{% endif %}
</div>
</div>
</div>