Skip to content

shopify创建配送日期代码片段步骤

shopify创建配送日期代码片段步骤
厦门商城系统开发

创建配送日期代码片段

若要为配送日期选择器创建代码片段,请执行以下操作:

PC:

  1. 在 Shopify 后台中,转到在线商店 > 模板
  2. 找到要编辑的模板,然后点击操作 > 编辑代码
  3. 在 Snippets 目录中,点击添加新代码片段
  4. 创建代码片段:
  5. 将代码片段命名为 delivery-date
  6. 点击创建代码片段。新的代码片段文件将在代码编辑器中打开。

苹果系统:

  1. 在 Shopify 后台中,转到在线商店 > 模板
  2. 找到要编辑的模板,然后点击操作 > 编辑代码
  3. 在 Snippets 目录中,点击添加新代码片段
  4. 创建代码片段:
  5. 将代码片段命名为 delivery-date
  6. 点击创建代码片段。新的代码片段文件将在代码编辑器中打开。

安卓系统:

  1. 在 Shopify 后台中,转到在线商店 > 模板
  2. 找到要编辑的模板,然后点击操作 > 编辑代码
  3. 在 Snippets 目录中,点击添加新代码片段
  4. 创建代码片段:
  5. 将代码片段命名为 delivery-date
  6. 点击创建代码片段。新的代码片段文件将在代码编辑器中打开。
  7. 在新的 delivery-date.liquid 代码片段中,粘贴以下代码:

“`html {{ ‘//code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css’ | stylesheet_tag }}

   

                We do not deliver during the week-end.   

 
  1. 点击**保存**。 ## 在购物车页面中包含代码片段 若要在购物车页面中包含配送日期代码片段,请执行以下操作: 1. 在 **Sections** 目录中,点击 `cart-template.liquid`。如果您的模板中没有此文件,则点击 **Templates** 目录中的 `cart.liquid`。 2. [查找](/manual/shopify-admin/productivity-tools/keyboard-shortcuts#find)代码中的结束 `` 标记。在结束 `` 标记上方的新行中,粘贴以下代码: ```liquid {% render 'delivery-date' %}
  1. 点击保存

您的购物车页面中现在将有一个配送日期输入字段。当您点击文本字段时,将出现日历:

此自定义设置中使用的日期选择器是 jQuery UI 库中的小组件。此博客文章介绍如何在日期选择器日历中禁用特定日期。

Shopify商户官网原文详情:



Create a delivery date snippet

To create a snippet for your delivery date picker:

PC:

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find the theme you want to edit, and then click Actions > Edit code.
  3. In the Snippets directory, click Add a new snippet:
  4. Create the snippet:
  5. Name your snippet delivery-date.
  6. Click Create snippet. The new snippet file will open in the code editor.

iPhone:

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find the theme you want to edit, and then click Actions > Edit code.
  3. In the Snippets directory, click Add a new snippet:
  4. Create the snippet:
  5. Name your snippet delivery-date.
  6. Click Create snippet. The new snippet file will open in the code editor.

Android:

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find the theme you want to edit, and then click Actions > Edit code.
  3. In the Snippets directory, click Add a new snippet:
  4. Create the snippet:
  5. Name your snippet delivery-date.
  6. Click Create snippet. The new snippet file will open in the code editor.
  7. In your new delivery-date.liquid snippet, paste the following code:
{{ '//code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css' | stylesheet_tag }}  
   

                We do not deliver during the week-end.   

 
 
  1. Click Save.

Include the snippet in your cart page

To include the delivery date snippet in your cart page:

  1. In the Sections directory, click cart-template.liquid. If your theme doesn’t have this file, then click cart.liquid in the Templates directory.
  2. Find the closing  tag in the code. On a new line above the closing  tag, paste the following code:
{% render 'delivery-date' %}
  1. Click Save.

You now have a delivery date input field on your cart page. When you click inside the text field, a calendar will appear:

The date picker used in this customization is a widget from the jQuery UI library. This blog post explains how to disable specific dates in the date picker calendar.

    码刀科技(www.lekshop.cn)是国内知名企业级电商平台提供商,为企业级商家提供最佳的电商平台搭建(多种模式电商平台搭建:B2B/B2B2C/B2C/O2O/新零售/跨境等)、平台管理系统开发及互联网采购解决方案服务, 联系客服了解更多.

    电子商务网站建设的重要性和好处