Html 如何根据标签和shopify中的可用库存显示不同的送货信息?

Html 如何根据标签和shopify中的可用库存显示不同的送货信息?,html,shopify,liquid,Html,Shopify,Liquid,我希望有人能帮我。我试图在设置为“超卖”的某些标记项目上显示交货状态 首先,我看产品是否贴上了“香水”标签,然后看库存是否高于或低于0 我从堆栈上的几个示例中拼凑出了这段代码(我对此非常陌生) 谢谢库萨 这是您的代码的编辑版本 它在我的产品页面上显示了这两个规则的输出 <div class="productShippingInformation"> {% if product.tags contains

我希望有人能帮我。我试图在设置为“超卖”的某些标记项目上显示交货状态

首先,我看产品是否贴上了“香水”标签,然后看库存是否高于或低于0

我从堆栈上的几个示例中拼凑出了这段代码(我对此非常陌生)


谢谢库萨


这是您的代码的编辑版本

它在我的产品页面上显示了这两个规则的输出

        <div class="productShippingInformation">
          
          {% if product.tags contains 'Discount Enabled' and current_variant.inventory_policy == 'continue' %}
          
         {% elsif current_variant.inventory_quantity >= 1 %}
           Delivered in 4-6 days.
         {% endif %}
         {% if current_variant.inventory_quantity <= 0 %}
          <b>Delivered in 10-14 days.</b>
             {% endif %}
          
               

          {% if product.tags contains 'Perfume & Aftershave' and current_variant.inventory_policy == 'continue' %}

    {% if current_variant.inventory_quantity <= 0 %}
      <div><b>Delivery in 2021.</b> please allow 20-30 days for delivery</div>
 
    {% elsif current_variant.inventory_quantity >= 1 %}
      <div>Order now for delivery within 7 days</div>

    {% endif %}

{% else %}
  <div>in stock for delivery in 4-6 days.</div>

{% endif %}

{%如果product.tags包含“已启用折扣”和当前的_variant.inventory_策略==“continue”%}
{%elsif当前_variant.inventory_数量>=1%}
4-6天内交付。
{%endif%}
{如果当前库存数量=1%,则为%1}
4-6天内交付。
{%endif%}

{%如果当前库存数量我会这样处理:

{% if product.tags contains 'perfume' and current_variant.inventory_policy == 'continue' %}

    {% if current_variant.inventory_quantity <= 0 %}
      <div>Out of Stock please allow 20-30 days for delivery</div>
 
    {% elsif current_variant.inventory_quantity >= 1 %}
      <div>Order now for delivery within 7 days</div>

    {% endif %}

{% else %}
  <div>We have {{ current_variant.inventory_quantity }} in stock for delivery in 4-6 days.</div>

{% endif %}
{%if product.tags包含“香水”和当前的_variant.inventory_策略==“continue”%}
{如果当前库存数量=1%,则为%1}
现在订购,7天内交货
{%endif%}
{%else%}
我们有{current_variant.inventory_quantity}库存,4-6天内交货。
{%endif%}

看起来您的主要问题是当前的变量。库存数量=1

我会这样处理:

{% if product.tags contains 'perfume' and current_variant.inventory_policy == 'continue' %}

    {% if current_variant.inventory_quantity <= 0 %}
      <div>Out of Stock please allow 20-30 days for delivery</div>
 
    {% elsif current_variant.inventory_quantity >= 1 %}
      <div>Order now for delivery within 7 days</div>

    {% endif %}

{% else %}
  <div>We have {{ current_variant.inventory_quantity }} in stock for delivery in 4-6 days.</div>

{% endif %}
{%if product.tags包含“香水”和当前的_variant.inventory_策略==“continue”%}
{如果当前库存数量=1%,则为%1}
现在订购,7天内交货
{%endif%}
{%else%}
我们有{current_variant.inventory_quantity}库存,4-6天内交货。
{%endif%}

看起来你的主要问题是
current\u variant.inventory\u quantity=1

太棒了-谢谢!我确实有一个小问题,当我运行这个规则时,我需要两种类型的消息,这取决于标签,所以我将它加倍,规则似乎会显示在所有产品上…我已经将代码添加到我的原始问题中,因为它是请不要让我插进去comments@Anthony-没问题,请记住将此答案标记为正确!太棒了-谢谢!我确实有一个小问题,当我运行此规则时,我需要两种类型的消息,具体取决于标记,因此我将其加倍,并且该规则似乎会显示在所有产品上…我已将代码添加到我的原始问题中不允许我把钱放进去comments@Anthony-没问题,记住将此答案标记为正确!
        <div class="productShippingInformation">
          
          {% if product.tags contains 'Discount Enabled' and current_variant.inventory_policy == 'continue' %}
          
         {% elsif current_variant.inventory_quantity >= 1 %}
           Delivered in 4-6 days.
         {% endif %}
         {% if current_variant.inventory_quantity <= 0 and product.tags contains 'Discount Enabled'%}
          <b>Delivered in 10-14 days.</b>
             {% endif %}
          </div>
        <div class="productShippingInformation">       

          {% if product.tags contains 'Perfume & Aftershave' and current_variant.inventory_policy == 'continue' %}

    {% if current_variant.inventory_quantity <= 0 %}
      <div><b>Delivery in 2021.</b> please allow 20-30 days for delivery</div>
 
    {% elsif current_variant.inventory_quantity >= 1 %}
      <div>Order now for delivery within 7 days</div>

    {% endif %}



{% endif %}
        
         </div>
{% if product.tags contains 'perfume' and current_variant.inventory_policy == 'continue' %}

    {% if current_variant.inventory_quantity <= 0 %}
      <div>Out of Stock please allow 20-30 days for delivery</div>
 
    {% elsif current_variant.inventory_quantity >= 1 %}
      <div>Order now for delivery within 7 days</div>

    {% endif %}

{% else %}
  <div>We have {{ current_variant.inventory_quantity }} in stock for delivery in 4-6 days.</div>

{% endif %}