【问题标题】:why additional script not working in shopify?为什么附加脚本在 shopify 中不起作用?
【发布时间】:2021-04-26 17:33:48
【问题描述】:

我想在 Shopify 结帐页面的运输方式下添加一些额外的内容。 像这样。 我的参考网站 https://www.thegldshop.com

enter image description here

为此,我找到了这篇文章并添加了这个脚本

https://help.shopify.com/en/manual/orders/status-tracking/customize-order-status/show-content-based-on-shipping-method

{% if checkout.shipping_method.title != 'Pick-up at the store' %}
      Shopify.Checkout.OrderStatus.addContentBox(
        `<p>Okay, we're ready for you to collect your products from 17 Mapple Crescent, Toronto. Our store is open 9:00 to 5:00 every day.</p>`
      )
    {% endif %}

但仍然不适合我。 这是我的网址

https://hypeyourbeast.com/

【问题讨论】:

  • 您检查的网站似乎有Shopify plus计划,其次,后端高级脚本部分代码仅在感谢页面上执行,而不是在结帐步骤上。
  • 这种类型的脚本用于shopify plus计划中的脚本编辑器

标签: javascript shopify e-commerce liquid shopify-template


【解决方案1】:

在 Shopify 中,您需要 Shopify plus 帐户才能在结帐页面上进行任何更改。如果没有 Shopify Plus 帐户,您将无法更改结帐页面上的任何内容。

【讨论】:

    【解决方案2】:

    您可以在没有 Shopify Plus 的情况下在结账时修改感谢/订单页面。在“谢谢”之前的任何步骤都需要 Plus 来编辑结帐。

    在附加脚本区域的代码周围添加标签。这段代码对我有用:

    <script> 
      // DEBUG {{ checkout.shipping_method.title }} has been used
       {% if checkout.shipping_method.title != 'Pick-up at the store' %}
         Shopify.Checkout.OrderStatus.addContentBox(
           `<p>Added content box {{ checkout.shipping_method.title }}</p>`
         )
       {% endif %}
    </script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-05-23
      • 1970-01-01
      • 1970-01-01
      • 2013-11-18
      • 1970-01-01
      • 2016-05-17
      • 2018-03-23
      相关资源
      最近更新 更多