根據運送方式顯示內容

瞭解如何使用包含 checkout.shipping_method.title 變數的條件。

例如,您可能為居住在您實體商店附近的顧客提供到店取貨選項。您可以在訂單狀態頁面上向他們提供零售店地址,但前提是顧客選取「到店取貨選項」。

步驟:

  1. 向下捲動至「其他指令碼」區段。

  2. 將下列程式碼複製到剪貼簿 (在 Mac 上使用 command + c,在 PC 上使用 ctrl + c)。

  <script>
    // DEBUG {{ checkout.shipping_method.title }} has been used
    {% 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 %}
  </script>
  1. 將程式碼貼進「其他指令碼」方塊。(在 Mac 上為 command + v,在 PC 上為 ctrl + v)

  2. 完成測試訂單以檢閱您的訂單狀態頁面。

準備好開始透過 Shopify 銷售商品了嗎?

免費試用