Удалить «Добавить в корзину» для определенных продуктов - PullRequest
0 голосов
/ 16 мая 2018

Я пытаюсь удалить кнопку «Добавить в корзину» для определенных категорий товаров. Есть ли способ запустить сценарий на странице продукта, чтобы взять крошку категории и использовать ее, чтобы определить, видна ли кнопка «Добавить в корзину»?

Вот код в коммерции 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>

...