Shopify 购物车页面上的手动折扣输入不起作用

问题描述 投票:0回答:3
shopify liquid shopping-cart
3个回答
0
投票

只要您的购物车没有使用 AJAX 来升级和转移,这应该可以工作。

结帐页面确认 ?rebate= 的获取争用,并包含带有 name="discount" 的字段,将将该争用包含到结帐中。

如果您专门生成标准形状,则这将起作用。 (如果你修改购物车,现场返利内容将不会出现,你需要重新输入)如果你必须修改形状,你可以通过几种方式保留markdown代码,通过修改使用 ajax 购物车或将其作为 cookie 存放起来。

所以你的代码应该可以工作,我在我的开发商店中对其进行了双重检查,没有任何问题,由于存在获取争用,它会向结帐页面应用回扣。

PS:这不包括购物车问题的回扣,因为它允许结帐转移包含获取竞争,仅此而已。所以通常相当于用

制作界面

结帐


0
投票

回复晚了,但想回答您的问题并分享解决方案。

首先,您不能按照您所描述的方式将折扣代码应用于购物车,这是可能且可行的,但比在表单中添加输入字段要复杂一些。

没有针对此的 OOTB Shopify 解决方案,但有一些未记录的 API 端点可用于创建此功能。

查看Shopify Discounter Web Component,它支持:

  1. 折扣码
  2. 自动折扣
  3. 礼品卡
  4. 折扣组合
  5. 多种货币
  6. 内化
  7. 使用 css 变量自定义样式
  8. 将其放置在商店的任何地方

希望这有帮助。


0
投票

在 Shopify 中,如果您使用的是 Dawn 主题,您只需删除 if 语句即可让折扣字段始终显示。

为此,请转到 main-cart-footer.liquid 部分文件并查找下面的代码块:

{%- if cart.cart_level_discount_applications.size > 0 -%}
                    <ul class="discounts list-unstyled" role="list" aria-label="{{ 'customer.order.discount' | t }}">
                      {%- for discount in cart.cart_level_discount_applications -%}
                        <li class="discounts__discount discounts__discount--position">
                          {%- render 'icon-discount' -%}
                          {{ discount.title }}
                          (-{{ discount.total_allocated_amount | money }})
                        </li>
                      {%- endfor -%}
                    </ul>
                  {%- endif -%}

只需删除包装 if 语句,您的最终代码应如下所示:

                    <ul class="discounts list-unstyled" role="list" aria-label="{{ 'customer.order.discount' | t }}">
                      {%- for discount in cart.cart_level_discount_applications -%}
                        <li class="discounts__discount discounts__discount--position">
                          {%- render 'icon-discount' -%}
                          {{ discount.title }}
                          (-{{ discount.total_allocated_amount | money }})
                        </li>
                      {%- endfor -%}
                    </ul>

享受吧!

© www.soinside.com 2019 - 2024. All rights reserved.