<delect id="epa7r"></delect><bdo id="epa7r"></bdo><noframes id="epa7r"><rt id="epa7r"><delect id="epa7r"></delect></rt><bdo id="epa7r"><rt id="epa7r"></rt></bdo><noframes id="epa7r"> <noframes id="epa7r"><rt id="epa7r"></rt><noframes id="epa7r"><noframes id="epa7r"><rt id="epa7r"><delect id="epa7r"></delect></rt><noframes id="epa7r"><noframes id="epa7r"><rt id="epa7r"><rt id="epa7r"></rt></rt><noframes id="epa7r"><rt id="epa7r"><delect id="epa7r"></delect></rt> <rt id="epa7r"><rt id="epa7r"></rt></rt><bdo id="epa7r"></bdo><noframes id="epa7r"><noframes id="epa7r"><noframes id="epa7r"><rt id="epa7r"><rt id="epa7r"></rt></rt><delect id="epa7r"></delect>
退出
Shopify新手指南
1998人已讀
1、本指南旨在幫助您打開思路、理清方向,順利開啟跨境之路。(持續更新中) 2、內容來源于各個公開渠道整理匯總,版權歸原作者所有。 3、使用建議:可使用快捷鍵 Ctrl +D/Command +D 的形式收藏至瀏覽器,方便下次訪問。
收藏(1248)
目錄導航
Shopify 簡介
定價計劃
概述
初始設置
商店設計清單
聘請幫助人員
遷移到 Shopify
開始使用
注意事項
Shopify 后臺
Shopify 后臺概述
支持的瀏覽器
備份和復制
搜索 Shopify 后臺
Shopify Mobile
生產力工具
Shopify 主頁
時間表
合規性
確保您的商店符合 Shopify 的政策
版權
在美國 (US) 的 Shopify 上銷售大麻二酚
隱私和安全
賬戶安全
隱私
您的賬戶
員工
登陸
管理賬單
管理賬戶
暫?;蛲S蒙痰?/div>
已凍結的 Shopify 商店
選擇您的賬戶語言和地區
與 Shopify 合作伙伴合作
推薦創業家使用 Shopify
在線商店
設置
模板
菜單和鏈接
博客
動態結賬按鈕
圖片
因假期關閉商店
Shopify Search & Discovery
搜索您的商店
速度
POS
開始使用 Shopify POS
通過 Shopify POS 當面銷售
QuickBooks POS
B2B
B2B 設置清單
產品目錄
公司
客戶
支付條款
信用卡儲存
結賬和賬戶
草稿訂單
測試 B2B 設置
B2B 模板代碼
銷售渠道
Facebook and Instagram by Meta
Google & YouTube
Shop
Linkpop
Buy Button
Shopify Collective
Faire 批發市場
TikTok Shop
批發
Shopify Marketplace Connect 應用
Shopify 結賬
結賬樣式
結賬表單選項
自定義和編輯結賬頁面
小費選項
設置地址收集偏好設置
訂單處理流程
結賬頁面語言
商店政策
機器人保護
結賬自定義項
測試訂單
Script Editor 應用
產品
產品套裝
添加產品
管理庫存
購買選項
產品詳細信息
數字產品
多屬性
產品媒體
產品系列
銷售禮品卡
導入和導出
搜索和篩選
為您的產品定價
Product Reviews
Handshake 批發市場
代發貨
暫時更改您的產品線
產品分析概述
域名
添加域名
更改域名類型和目標
移除域名
管理域名的所有權
電子郵件托管和轉發
管理域名設置
域名術語
對域名問題進行故障排除
收款
獲得收款
Shop Pay
Shopify Payments
PayPal Express
Shop Cash
Shop Pay 分期付款
快捷結賬
第三方提供商
其他付款方式
線下付款
支付授權和獲取款項
拒付和查詢
欺詐預防
Advanced Cash on Delivery
問題排查
地點
設置您的地點
將庫存分配給各個地點
設置您的地點發貨
發貨和配送
Shopify 發貨網絡
了解運輸
設置和管理您的發貨和配送
Shopify Shipping
碳中和運輸
發貨和代發貨服務
Shop Promise
客戶
管理客戶
客戶賬戶
搜索客戶資料
客戶細分
導入和導出客戶
從 MailChimp 導入
Bulk Account Inviter
提供在線客戶服務
解決客戶 CSV 文件錯誤
Shopify Flow
創建工作流
監視工作流
管理工作流
手動運行工作流
高級工作流
Shopify Flow 參考信息
訂單
訂單狀態頁面
發貨
處理訂單
創建草稿訂單
管理訂單
訂單狀態
導出為 CSV 文件
搜索、查看和打印訂單
自助退貨
Order Printer
創建退貨和退款
管理訂閱訂單
編輯訂單商品
入賬付款
延期付款
取消、存檔和刪除訂單
欺詐風險分析
恢復棄單
轉化跟蹤
通知
聯系 Shopify 商店以了解訂單
Fraud Filter
管理增加的銷售額
訂單分析概述
折扣
折扣類型
組合折扣
管理折扣碼
導出折扣碼
設置促銷價格
棄單電子郵件
禮品卡折扣
銷售渠道折扣
常見問題解答
Shopify Inbox
安裝和訪問 Shopify Inbox
管理客戶對話
配置 Shopify Inbox
聊天設置和外觀
對話指標
自定義數據
Metafields
元對象
訪問選項
功能
復制到訂單
營銷和促銷
制定營銷計劃
內容營銷
管理您的品牌資產
改進SEO
Shopify 中的營銷
Shopify Audiences
分析在線營銷
遠程購物體驗
為季節性銷售做準備
Shopify Collabs
限時搶購
像素代碼和客戶活動
分析
Shopify 分析
Google Analytics
ShopifyQL Notebooks
分析差異
應用
應用類型
查找應用
選擇應用
安裝應用
卸載應用
管理應用
獲取應用幫助
不受支持的應用
應用權限和個人信息
對第三方應用的支持
Shopify Markets
管理市場
以當地貨幣定價
自動重定向
國際域名
本地化和翻譯
關稅和進口稅
收款
運輸和市場
使用 Markets 發布產品
Shopify Markets Pro
專家市場
聘請幫助人員
與專家合作
向專家付款
處理爭議
完成工作
合作伙伴目錄
聘請幫助人員
稅費
一般稅款設置步驟
基于地點的稅費設置
基于登記的稅費設置
Shopify Tax
美國稅費
加拿大稅費
歐盟稅費
英國稅費
Shopify POS 稅費
數字產品稅
手動稅費和免稅
運費稅
關稅和進口稅
印度的 GST
Avalara AvaTax 提供的稅務服務
日本稅費
Data Exporter
德國的 TSE 合規
稅務報告
組織設置
訪問“組織設置”
管理用戶
賬單
用戶安全
管理商店
組織分析
Shopify Plus Academy
自定義購物體驗
自定義購物體驗
資金
財務概述
Shopify Balance
Shopify Capital
Shopify Credit
Shopify Bill Pay
添加快速訂單列表

免費 Shopify 模板的版本 11.0.0 或更高版本中支持快速訂單列表分區。如果您想在商店中添加“快速訂單列表”分區,則可將商店模板更新為最新版本。

如果您不想更改或更新模板,則可以使用 Liquid 或 Javascript 向您的模板中添加代碼,以在產品頁面上顯示“快速訂單列表”分區。

在更新您的模板文件之前,請確保復制您的模板以創建備份副本。


拓展您的業務

這屬于高級教程。如果您不擅長查閱和編輯模板代碼,則您可以與開發人員合作或聘請 Shopify 專家。


添加 Liquid 快速訂單列表代碼

您可以將代碼添加到您模板的以下文件中,以支持“快速訂單列表”分區:

main-product.liquid 或等效文件 步驟: 在 Shopify 后臺中,轉至在線商店 > 模板。 找到要編輯的模板,點擊 ... 按鈕打開操作菜單,然后點擊編輯代碼。 打開要編輯的文件。 在文件底部創建新行,然后添加以下代碼: {%#theme-check-disable%}{%-assignitems_in_cart=cart|line_items_for:product|sum:'quantity'-%}{%#theme-check-enable%}<div class="color-background-1 gradient"> <quick-order-list class="page-width" id="quick-order-list" data-id="{{section.id}}" > <form action="{{routes.cart_update_url}}" class="quick-order-list__contents critical-hidden" method="post" id="QuickOrderList" > <div class="quick-order-list__container" id="main-variant-items"> <div class="js-contents"> <table class="quick-order-list__table"> <caption class="visually-hidden"> Quick Order List </caption> <thead> <tr> <th class="caption-with-letter-spacing" scope="col">{%-ifproduct.has_only_default_variant-%}Product{%-else-%}Variant{%-endif-%}</th> <th class="large-up-hide right caption-with-letter-spacing" scope="col">{%-ifproduct.has_only_default_variant-%}Product subtotal{%-else-%}Variant total{%-endif-%}</th> <th class="quick-order-list__table-heading--wide small-hide medium-hide caption-with-letter-spacing" scope="col" > Quantity </th> <th class="quick-order-list__table-heading--wide small-hide medium-hide caption-with-letter-spacing" scope="col" > Price </th> <th class="small-hide medium-hide right caption-with-letter-spacing" scope="col">{%-ifproduct.has_only_default_variant-%}Product subtotal{%-else-%}Variant total{%-endif-%}</th> </tr> </thead> <tbody>{%-ifproduct.has_only_default_variant-%}{%#theme-check-disable%}{%assigncart_qty=cart|item_count_for_variant:product.selected_or_first_available_variant.id%}{%#theme-check-enable%}<tr class="variant-item" id="Variant-{{product.selected_or_first_available_variant.id}}" data-variant-id="{{product.selected_or_first_available_variant.id}}" data-cart-qty="{{cart_qty}}" > <td class="variant-item__inner"> <div class="variant-item__media"> <div class="variant-item__image-container gradient global-media-settings{%unlessproduct.featured_media%}variant-item__image-container--no-img{%endunless%}">{%ifproduct.featured_media%}{%-assignimg_height=43|divided_by:product.featured_media.aspect_ratio|ceil-%}{{product.featured_media|image_url:width:86|image_tag:loading:'lazy',fetchpriority:'low',decoding:'async',class:'variant-item__image',width:43,height:img_height,widths:'86',alt:product.featured_media.alt|escape}}{%endif%}</div> </div> <div class="small-hide medium-hide"> <span class="variant-item__name h4 break">{{product.title|escape}}</span>{%-ifproduct.sku-%}<span class="variant-item__sku break">{{product.selected_or_first_available_variant.sku|escape}}</span>{%-endif-%}</div> </td> <td class="variant-item__details large-up-hide"> <div class="variant-item__info"> <span class="variant-item__name h4 break">{{variant.title|escape}}</span>{%-ifproduct.selected_or_first_available_variant.sku-%}<span class="variant-item__sku break">{{product.selected_or_first_available_variant.sku|escape}}</span>{%-endif-%}</div>{%-assignitem_price=product.selected_or_first_available_variant.price|money-%}{%-ifproduct.selected_or_first_available_variant.compare_at_price-%}<dl class="variant-item__discounted-prices"> <dt class="visually-hidden"> Regular price </dt> <dd> <s class="variant-item__old-price price price--end">{{product.selected_or_first_available_variant.compare_at_price|money}}</s> </dd> <dt class="visually-hidden"> Sale price </dt> <dd class="price"> <span class="price">{{item_price}}/ea </span> </dd> </dl>{%-else-%}<span class="price">{{item_price}}/ea </span>{%-endif-%}{%-ifproduct.selected_or_first_available_variant.availableandproduct.selected_or_first_available_variant.unit_price_measurement-%}<div class="unit-price caption"> <span class="visually-hidden">Unit price</span>{{product.selected_or_first_available_variant.unit_price|money}}<span aria-hidden="true">/</span> <span class="visually-hidden">&nbsp;per&nbsp;</span>{%-ifproduct.selected_or_first_available_variant.unit_price_measurement.reference_value!=1-%}{{-product.selected_or_first_available_variant.unit_price_measurement.reference_value-}}{%-endif-%}{{product.selected_or_first_available_variant.unit_price_measurement.reference_unit}}</div>{%-endif-%}</td> <td class="variant-item__totals right large-up-hide">{%-render'loading-overlay'-%}{%comment%}TODO: enable theme-check once `line_items_for` is accepted as valid filter{%endcomment%}{%#theme-check-disable%}<span class="price">{{cart|line_items_for:product.selected_or_first_available_variant|sum:'original_line_price'|money}}</span>{%#theme-check-enable%}</td> <td class="variant-item__quantity"> <quantity-popover> <div class="variant-item__quantity-wrapper quantity-popover-wrapper variant-item__quantity-wrapper--no-info"> <label class="visually-hidden" for="Quantity-{{variant.id}}"> Quantity </label> <div class="quantity-popover-container">{%-ifproduct.selected_or_first_available_variant.available==false-%}<span class="variant-item__sold-out h4"> Sold out </span>{%-else-%}{%comment%}TODO: Remove theme check{%endcomment%}{%#theme-check-disable%}{%assigncart_qty=cart|item_count_for_variant:product.selected_or_first_available_variant.id%}{%#theme-check-enable%}{%render'quantity-input',variant:product.selected_or_first_available_variant%}{%-endif-%}</div>{%-ifcart_qty>0-%}<quick-order-list-remove-button id="Remove-{{product.selected_or_first_available_variant.id}}" data-index="{{product.selected_or_first_available_variant.id}}" > <a href="{{product.selected_or_first_available_variant.url_to_remove}}" class="button button--tertiary" aria-label="Remove{{variant.title}}" >{%render'icon-remove'%}</a> </quick-order-list-remove-button>{%-endif-%}</div> <div class="variant-item__error large-up-hide" id="Quick-order-list-item-error-mobile-{{product.selected_or_first_available_variant.id}}" role="alert" > <small class="variant-item__error-text"></small>{%render'icon-error'%}</div> </quantity-popover> </td>{%-assignitem_price=product.selected_or_first_available_variant.price|money-%}<td class="variant-item__price small-hide medium-hide">{%-ifvariant.compare_at_price-%}<dl class="variant-item__discounted-prices"> <dt class="visually-hidden"> Regular price </dt> <dd> <s class="variant-item__old-price price price--end">{{product.selected_or_first_available_variant.compare_at_price|money}}</s> </dd> <dt class="visually-hidden"> Sale price </dt> <dd class="price"> <span class="price">{{item_price}}/ea </span> </dd> </dl>{%-else-%}<span class="price">{{item_price}}/ea </span>{%-endif-%}{%-ifproduct.selected_or_first_available_variant.availableandproduct.selected_or_first_available_variant.unit_price_measurement-%}<div class="unit-price caption"> <span class="visually-hidden">Unit price</span>{{variant.unit_price|money}}<span aria-hidden="true">/</span> <span class="visually-hidden">&nbsp;per&nbsp;</span>{%-ifproduct.selected_or_first_available_variant.unit_price_measurement.reference_value!=1-%}{{-product.selected_or_first_available_variant.unit_price_measurement.reference_value-}}{%-endif-%}{{product.selected_or_first_available_variant.unit_price_measurement.reference_unit}}</div>{%-endif-%}</td> <td class="variant-item__totals right small-hide medium-hide">{%-render'loading-overlay'-%}{%comment%}TODO: enable theme-check once `line_items_for` is accepted as valid filter{%endcomment%}{%#theme-check-disable%}<span class="price">{{cart|line_items_for:product.selected_or_first_available_variant|sum:'original_line_price'|money}}</span>{%#theme-check-enable%}</td> </tr> <tr class="small-hide medium-hide hidden desktop-row-error"> <td></td> <td> <div class="variant-item__error" id="Quick-order-list-item-error-desktop-{{variant.id}}" role="alert"> <small class="variant-item__error-text"></small>{%render'icon-error'%}</div> </td> <td></td> <td></td> </tr>{%-else-%}{%-forvariantinproduct.variants-%}{%#theme-check-disable%}{%assigncart_qty=cart|item_count_for_variant:variant.id%}{%#theme-check-enable%}<tr class="variant-item" id="Variant-{{variant.id}}" data-variant-id="{{variant.id}}" data-cart-qty="{{cart_qty}}" > <td class="variant-item__inner"> <div class="variant-item__media"> <div class="variant-item__image-container gradient global-media-settings{%unlessvariant.image%}variant-item__image-container--no-img{%endunless%}">{%ifvariant.image%}{%-assignimg_height=43|divided_by:variant.image.aspect_ratio|ceil-%}{{variant.image|image_url:width:86|image_tag:loading:'lazy',fetchpriority:'low',decoding:'async',class:'variant-item__image',width:43,height:img_height,widths:'86',alt:variant.image.alt|escape}}{%endif%}</div> </div> <div class="small-hide medium-hide"> <span class="variant-item__name h4 break">{{variant.title|escape}}</span>{%-ifvariant.sku-%}<span class="variant-item__sku break">{{variant.sku|escape}}</span>{%-endif-%}</div> </td> <td class="variant-item__details large-up-hide"> <div class="variant-item__info"> <span class="variant-item__name h4 break">{{variant.title|escape}}</span>{%-ifvariant.sku-%}<span class="variant-item__sku break">{{variant.sku|escape}}</span>{%-endif-%}</div>{%-assignitem_price=variant.price|money-%}{%-ifvariant.compare_at_price-%}<dl class="variant-item__discounted-prices"> <dt class="visually-hidden"> Regular price </dt> <dd> <s class="variant-item__old-price price price--end">{{variant.compare_at_price|money}}</s> </dd> <dt class="visually-hidden"> Sale price </dt> <dd class="price"> <span class="price">{{item_price}}/ea </span> </dd> </dl>{%-else-%}<span class="price">{{item_price}}/ea </span>{%-endif-%}{%-ifvariant.availableandvariant.unit_price_measurement-%}<div class="unit-price caption"> <span class="visually-hidden">Unit price</span>{{variant.unit_price|money}}<span aria-hidden="true">/</span> <span class="visually-hidden">&nbsp;per&nbsp;</span>{%-ifvariant.unit_price_measurement.reference_value!=1-%}{{-variant.unit_price_measurement.reference_value-}}{%-endif-%}{{variant.unit_price_measurement.reference_unit}}</div>{%-endif-%}</td> <td class="variant-item__totals right large-up-hide">{%-render'loading-overlay'-%}{%comment%}TODO: enable theme-check once `line_items_for` is accepted as valid filter{%endcomment%}{%#theme-check-disable%}<span class="price">{{cart|line_items_for:variant|sum:'original_line_price'|money}}</span>{%#theme-check-enable%}</td> <td class="variant-item__quantity"> <quantity-popover> <div class="variant-item__quantity-wrapper quantity-popover-wrapper variant-item__quantity-wrapper--no-info"> <label class="visually-hidden" for="Quantity-{{variant.id}}"> Quantity </label> <div class="quantity-popover-container">{%-ifvariant.available==false-%}<span class="variant-item__sold-out h4">Sold out</span>{%-else-%}{%comment%}TODO: Remove theme check{%endcomment%}{%#theme-check-disable%}{%assigncart_qty=cart|item_count_for_variant:variant.id%}{%#theme-check-enable%}{%render'quantity-input',variant:variant%}{%-endif-%}</div>{%-ifcart_qty>0-%}<quick-order-list-remove-button id="Remove-{{variant.id}}" data-index="{{variant.id}}" > <a href="{{variant.url_to_remove}}" class="button button--tertiary" aria-label="Remove{{variant.title}}" >{%render'icon-remove'%}</a> </quick-order-list-remove-button>{%-endif-%}</div> <div class="variant-item__error large-up-hide" id="Quick-order-list-item-error-mobile-{{variant.id}}" role="alert" > <small class="variant-item__error-text"></small>{%render'icon-error'%}</div> </quantity-popover> </td>{%-assignitem_price=variant.price|money-%}<td class="variant-item__price small-hide medium-hide">{%-ifvariant.compare_at_price-%}<dl class="variant-item__discounted-prices"> <dt class="visually-hidden"> Regular price </dt> <dd> <s class="variant-item__old-price price price--end">{{variant.compare_at_price|money}}</s> </dd> <dt class="visually-hidden"> Sale price </dt> <dd class="price"> <span class="price">{{item_price}}/ea </span> </dd> </dl>{%-else-%}<span class="price">{{item_price}}/ea </span>{%-endif-%}{%-ifvariant.availableandvariant.unit_price_measurement-%}<div class="unit-price caption"> <span class="visually-hidden">Unit price</span>{{variant.unit_price|money}}<span aria-hidden="true">/</span> <span class="visually-hidden">&nbsp;per&nbsp;</span>{%-ifvariant.unit_price_measurement.reference_value!=1-%}{{-variant.unit_price_measurement.reference_value-}}{%-endif-%}{{variant.unit_price_measurement.reference_unit}}</div>{%-endif-%}</td> <td class="variant-item__totals right small-hide medium-hide">{%-render'loading-overlay'-%}{%comment%}TODO: enable theme-check once `line_items_for` is accepted as valid filter{%endcomment%}{%#theme-check-disable%}<span class="price">{{cart|line_items_for:variant|sum:'original_line_price'|money}}</span>{%#theme-check-enable%}</td> </tr> <tr class="small-hide medium-hide hidden desktop-row-error"> <td></td> <td> <div class="variant-item__error" id="Quick-order-list-item-error-desktop-{{variant.id}}" role="alert"> <small class="variant-item__error-text"></small>{%render'icon-error'%}</div> </td> <td></td> <td></td> </tr>{%-endfor-%}{%-endif-%}</tbody> </table> </div> <noscript>{%-ifproduct.has_only_default_variantorproduct.variants.size==1-%}<button type="submit" class="button button--secondary right" formnovalidate form="QuickOrderList"> Update </button>{%-endif-%}</noscript> </div> <p class="visually-hidden" id="quick-order-list-live-region-text" aria-live="polite" role="status"></p> <p class="visually-hidden" id="shopping-cart-variant-item-status" aria-live="polite" aria-hidden="true" role="status" > Loading... </p> </form>{%-ifproduct.has_only_default_variantorproduct.variants.size==1-%}<span class="quick-order-list-error">{%comment%}Populated by JS{%endcomment%}</span>{%-else-%}<div class="quick-order-list__total gradient" id="quick-order-list-total"> <div class="quick-order-list-total__info"> <div class="quick-order-list-total__column small-hide medium-hide"> <div class="quick-order-list-buttons"> <a href="{{routes.cart_url}}" class="quick-order-list__button button button--secondary small-hide medium-hide" > <span class="quick-order-list__button-text">View cart</span> </a> <div class="variant-remove-total">{%-render'loading-overlay'-%}<quick-order-list-remove-all-button class="no-js-hidden" data-action="confirm" > <button class="button button--tertiary" type="button">{%render'icon-remove'%}<span class="text-body">Remove all</span> </button> </quick-order-list-remove-all-button> </div> </div> <span class="quick-order-list__message caption-large" role="status"> <span class="quick-order-list__message-icon hidden">{%-render'icon-checkmark'-%}</span> <span class="quick-order-list__message-text"></span> </span> <span class="quick-order-list-error">{%comment%}Populated by JS{%endcomment%}</span> </div> <div class="quick-order-list__total-items"> <h3>{{items_in_cart}}</h3> <p class="h5">Total items</p> </div> <div class="quick-order-list-total__price"> <noscript> <button type="submit" class="button button--secondary" formnovalidate form="QuickOrderList"> Update </button> </noscript> <div class="totals__product-total"> <h3 class="totals__subtotal-value">{%comment%}TODO: enable theme-check once `line_items_for` is accepted as valid filter{%endcomment%}{%#theme-check-disable%}{{cart|line_items_for:product|sum:'original_line_price'|money}}{%#theme-check-enable%}</h3> <p class="totals__subtotal h5">Product subtotal</p> </div> <small class="tax-note caption-large rte">{%-ifcart.taxes_includedandshop.shipping_policy.body!=blank-%}Tax included. <a href="{{shop.shipping_policy.url}}">Shipping</a> and discounts calculated at checkout.{%-elsifcart.taxes_included-%}Tax included and shipping and discounts calculated at checkout{%-elsifshop.shipping_policy.body!=blank-%}Taxes, Discounts and <a href="{{shop.shipping_policy.url}}">shipping</a> calculated at checkout{%-else-%}Taxes, discounts and shipping calculated at checkout{%-endif-%}</small> </div> <div class="quick-order-list-total__column large-up-hide"> <div class="quick-order-list-buttons"> <a href="{{routes.cart_url}}" class="quick-order-list__button button button--secondary button--full-width" > <span class="quick-order-list__button-text">View cart</span> </a> <div class="variant-remove-total">{%-render'loading-overlay'-%}<quick-order-list-remove-all-button class="no-js-hidden" data-action="confirm" > <button class="button button--tertiary" type="button">{%render'icon-remove'%}<span class="text-body">Remove all</span> </button> </quick-order-list-remove-all-button> </div> </div> <span class="quick-order-list__message caption-large" role="status"> <span class="quick-order-list__message-icon hidden">{%-render'icon-checkmark'-%}</span> <span class="quick-order-list__message-text"></span> </span> <span class="quick-order-list-error">{%comment%}Populated by JS{%endcomment%}</span> </div> </div> <div class="quick-order-list-total__confirmation hidden"> <span class="text-body"> Remove all{{items_in_cart}}items from your cart? </span> <quick-order-list-remove-all-button data-action="remove" > <button class="quick-order-list__button-confirm button button--secondary" type="button" > Remove all </button> </quick-order-list-remove-all-button> <quick-order-list-remove-all-button data-action="cancel" > <button class="quick-order-list__button-cancel button button--tertiary" type="button" > Cancel </button> </quick-order-list-remove-all-button> </div> </div>{%-endif-%}</quick-order-list> <template id="QuickOrderListErrorTemplate-{{section.id}}">{%render'icon-error'%}<span class="quick-order-list-error-message caption-large" role="alert"></span> </template> </div> 點擊保存。


添加 Javascript 快速訂單列表代碼

當多屬性的購物車數量發生變化時,產品小計、多屬性小計和可能出現的錯誤狀態將會更新??梢允褂?Javascript 代碼獲取更新后的值。

您可以向 theme.js 文件或等效文件中添加代碼。

步驟:

在 Shopify 后臺中,轉至在線商店 > 模板。 找到要編輯的模板,點擊 ... 按鈕打開操作菜單,然后點擊編輯代碼。 打開 theme.js 文件。 在文件底部創建新行,然后添加以下代碼: classQuickOrderListRemoveButtonextendsHTMLElement{constructor(){super();this.addEventListener('click',(event)=>{event.preventDefault();constquickOrderList=this.closest('quick-order-list');quickOrderList.updateQuantity(this.dataset.index,0);});}}customElements.define('quick-order-list-remove-button',QuickOrderListRemoveButton);classQuickOrderListRemoveAllButtonextendsHTMLElement{constructor(){super();constallVariants=Array.from(document.querySelectorAll('[data-variant-id]'));constitems={}lethasVariantsInCart=false;this.quickOrderList=this.closest('quick-order-list');allVariants.forEach((variant)=>{constcartQty=parseInt(variant.dataset.cartQty);if(cartQty>0){hasVariantsInCart=true;items[parseInt(variant.dataset.variantId)]=0;}});if(!hasVariantsInCart){this.classList.add('hidden');}this.actions={confirm:'confirm',remove:'remove',cancel:'cancel'}this.addEventListener('click',(event)=>{event.preventDefault();if(this.dataset.action===this.actions.confirm){this.toggleConfirmation(false,true);}elseif(this.dataset.action===this.actions.remove){this.quickOrderList.updateMultipleQty(items);this.toggleConfirmation(true,false);}elseif(this.dataset.action===this.actions.cancel){this.toggleConfirmation(true,false);}});}toggleConfirmation(showConfirmation,showInfo){this.quickOrderList.querySelector('.quick-order-list-total__confirmation').classList.toggle('hidden',showConfirmation);this.quickOrderList.querySelector('.quick-order-list-total__info').classList.toggle('hidden',showInfo)}}customElements.define('quick-order-list-remove-all-button',QuickOrderListRemoveAllButton);classQuickOrderListextendsHTMLElement{constructor(){super();this.cart=document.querySelector('cart-drawer');this.actions={add:'ADD',update:'UPDATE'}this.quickOrderListId='quick-order-list'this.variantItemStatusElement=document.getElementById('shopping-cart-variant-item-status');constform=this.querySelector('form');form.addEventListener('submit',this.onSubmit.bind(this));constdebouncedOnChange=debounce((event)=>{this.onChange(event);},ON_CHANGE_DEBOUNCE_TIMER);this.addEventListener('change',debouncedOnChange.bind(this));}cartUpdateUnsubscriber=undefined;onSubmit(event){event.preventDefault();}connectedCallback(){this.cartUpdateUnsubscriber=subscribe(PUB_SUB_EVENTS.cartUpdate,(event)=>{if(event.source===this.quickOrderListId){return;}// If its another section that made the updatethis.onCartUpdate();});this.sectionId=this.dataset.id;}disconnectedCallback(){if(this.cartUpdateUnsubscriber){this.cartUpdateUnsubscriber();}}onChange(event){constinputValue=parseInt(event.target.value);constcartQuantity=parseInt(event.target.dataset.cartQuantity);constindex=event.target.dataset.index;constname=document.activeElement.getAttribute('name');constquantity=inputValue-cartQuantity;if(cartQuantity>0){this.updateQuantity(index,inputValue,name,this.actions.update);}else{this.updateQuantity(index,quantity,name,this.actions.add);}}onCartUpdate(){fetch(`${window.location.pathname}?section_id=${this.sectionId}`).then((response)=>response.text()).then((responseText)=>{consthtml=newDOMParser().parseFromString(responseText,'text/html');constsourceQty=html.querySelector(this.quickOrderListId);this.innerHTML=sourceQty.innerHTML;}).catch(e=>{console.error(e);});}getSectionsToRender(){return[{id:this.quickOrderListId,section:document.getElementById(this.quickOrderListId).dataset.id,selector:'.js-contents'},{id:'cart-icon-bubble',section:'cart-icon-bubble',selector:'.shopify-section'},{id:'quick-order-list-live-region-text',section:'cart-live-region-text',selector:'.shopify-section'},{id:'quick-order-list-total',section:document.getElementById(this.quickOrderListId).dataset.id,selector:'.quick-order-list__total'},{id:'CartDrawer',selector:'#CartDrawer',section:'cart-drawer'}];}renderSections(parsedState){this.getSectionsToRender().forEach((section=>{constsectionElement=document.getElementById(section.id);if(sectionElement&&sectionElement.parentElement&&sectionElement.parentElement.classList.contains('drawer')){parsedState.items.length>0?sectionElement.parentElement.classList.remove('is-empty'):sectionElement.parentElement.classList.add('is-empty');setTimeout(()=>{document.querySelector('#CartDrawer-Overlay').addEventListener('click',this.cart.close.bind(this.cart));});}constelementToReplace=sectionElement&&sectionElement.querySelector(section.selector)?sectionElement.querySelector(section.selector):sectionElement;if(elementToReplace){elementToReplace.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.section],section.selector);}}));}updateMultipleQty(items){this.querySelector('.variant-remove-total .loading-overlay').classList.remove('hidden');constbody=JSON.stringify({updates:items,sections:this.getSectionsToRender().map((section)=>section.section),sections_url:window.location.pathname});this.updateMessage();this.setErrorMessage();fetch(`${routes.cart_update_url}`,{...fetchConfig(),...{body}}).then((response)=>{returnresponse.text();}).then((state)=>{constparsedState=JSON.parse(state);this.renderSections(parsedState);}).catch(()=>{this.setErrorMessage('There was an error while updating your cart. Please try again.');}).finally(()=>{this.querySelector('.variant-remove-total .loading-overlay').classList.add('hidden');});}updateQuantity(id,quantity,name,action){this.toggleLoading(id,true);letrouteUrl=routes.cart_change_url;letbody=JSON.stringify({quantity,id,sections:this.getSectionsToRender().map((section)=>section.section),sections_url:window.location.pathname});letfetchConfigType;if(action===this.actions.add){fetchConfigType='javascript';routeUrl=routes.cart_add_url;body=JSON.stringify({items:[{quantity:parseInt(quantity),id:parseInt(id)}],sections:this.getSectionsToRender().map((section)=>section.section),sections_url:window.location.pathname});}this.updateMessage();this.setErrorMessage();fetch(`${routeUrl}`,{...fetchConfig(fetchConfigType),...{body}}).then((response)=>{returnresponse.text();}).then((state)=>{constparsedState=JSON.parse(state);constquantityElement=document.getElementById(`Quantity-${id}`);constitems=document.querySelectorAll('.variant-item');if(parsedState.description||parsedState.errors){constvariantItem=document.querySelector(`[id^="Variant-${id}"] .variant-item__totals.small-hide .loading-overlay`);variantItem.classList.add('loading-overlay--error');this.resetQuantityInput(id,quantityElement);if(parsedState.errors){this.updateLiveRegions(id,parsedState.errors);}else{this.updateLiveRegions(id,parsedState.description);}return;}this.classList.toggle('is-empty',parsedState.item_count===0);this.renderSections(parsedState);lethasError=false;constcurrentItem=parsedState.items.find((item)=>item.variant_id===parseInt(id));constupdatedValue=currentItem?currentItem.quantity:undefined;if(updatedValue&&updatedValue!==quantity){this.updateError(updatedValue,id);hasError=true;}constvariantItem=document.getElementById(`Variant-${id}`);if(variantItem&&variantItem.querySelector(`[name="${name}"]`)){variantItem.querySelector(`[name="${name}"]`).focus();}publish(PUB_SUB_EVENTS.cartUpdate,{source:this.quickOrderListId,cartData:parsedState});if(hasError){this.updateMessage();}elseif(action===this.actions.add){this.updateMessage(parseInt(quantity))}elseif(action===this.actions.update){this.updateMessage(parseInt(quantity-quantityElement.dataset.cartQuantity))}else{this.updateMessage(-parseInt(quantityElement.dataset.cartQuantity))}}).catch((error)=>{this.querySelectorAll('.loading-overlay').forEach((overlay)=>overlay.classList.add('hidden'));this.resetQuantityInput(id);console.error(error);this.setErrorMessage('There was an error while updating your cart. Please try again.');}).finally(()=>{this.toggleLoading(id);});}resetQuantityInput(id,quantityElement){constinput=quantityElement??document.getElementById(`Quantity-${id}`);input.value=input.getAttribute('value');}setErrorMessage(message=null){this.errorMessageTemplate=this.errorMessageTemplate??document.getElementById(`QuickOrderListErrorTemplate-${this.sectionId}`).cloneNode(true);consterrorElements=document.querySelectorAll('.quick-order-list-error');errorElements.forEach((errorElement)=>{errorElement.innerHTML='';if(!message)return;constupdatedMessageElement=this.errorMessageTemplate.cloneNode(true);updatedMessageElement.content.querySelector('.quick-order-list-error-message').innerText=message;errorElement.appendChild(updatedMessageElement.content);});}updateMessage(quantity=null){constmessages=this.querySelectorAll('.quick-order-list__message-text');consticons=this.querySelectorAll('.quick-order-list__message-icon');if(quantity===null||isNaN(quantity)){messages.forEach(message=>message.innerHTML='');icons.forEach(icon=>icon.classList.add('hidden'));return;}constisQuantityNegative=quantity<0;constabsQuantity=Math.abs(quantity);consttextTemplate=isQuantityNegative?(absQuantity===1?`${absQuantity}item removed`:`${absQuantity}items removed`):(quantity===1?`${absQuantity}item added`:`${absQuantity}items added`)messages.forEach((msg)=>msg.innerHTML=textTemplate);if(!isQuantityNegative){icons.forEach((i)=>i.classList.remove('hidden'));}}updateError(updatedValue,id){letmessage='';if(typeofupdatedValue==='undefined'){message='There was an error while updating your cart. Please try again.';}else{message=`You can only add${updatedValue}of this item to your cart.`;}this.updateLiveRegions(id,message);}updateLiveRegions(id,message){constvariantItemErrorDesktop=document.getElementById(`Quick-order-list-item-error-desktop-${id}`);constvariantItemErrorMobile=document.getElementById(`Quick-order-list-item-error-mobile-${id}`);if(variantItemErrorDesktop){variantItemErrorDesktop.querySelector('.variant-item__error-text').innerHTML=message;variantItemErrorDesktop.closest('tr').classList.remove('hidden');}if(variantItemErrorMobile)variantItemErrorMobile.querySelector('.variant-item__error-text').innerHTML=message;this.variantItemStatusElement.setAttribute('aria-hidden',true);constcartStatus=document.getElementById('quick-order-list-live-region-text');cartStatus.setAttribute('aria-hidden',false);setTimeout(()=>{cartStatus.setAttribute('aria-hidden',true);},1000);}getSectionInnerHTML(html,selector){returnnewDOMParser().parseFromString(html,'text/html').querySelector(selector).innerHTML;}toggleLoading(id,enable){constquickOrderList=document.getElementById(this.quickOrderListId);constquickOrderListItems=this.querySelectorAll(`#Variant-${id}.loading-overlay`);if(enable){quickOrderList.classList.add('quick-order-list__container--disabled');[...quickOrderListItems].forEach((overlay)=>overlay.classList.remove('hidden'));document.activeElement.blur();this.variantItemStatusElement.setAttribute('aria-hidden',false);}else{quickOrderList.classList.remove('quick-order-list__container--disabled');quickOrderListItems.forEach((overlay)=>overlay.classList.add('hidden'));}}}customElements.define('quick-order-list',QuickOrderList); 點擊保存。

91精品孕妇系列|国产综合在线视频|日韩人妻无码一级潮喷中|女高中自慰喷水免费网站
<delect id="epa7r"></delect><bdo id="epa7r"></bdo><noframes id="epa7r"><rt id="epa7r"><delect id="epa7r"></delect></rt><bdo id="epa7r"><rt id="epa7r"></rt></bdo><noframes id="epa7r"> <noframes id="epa7r"><rt id="epa7r"></rt><noframes id="epa7r"><noframes id="epa7r"><rt id="epa7r"><delect id="epa7r"></delect></rt><noframes id="epa7r"><noframes id="epa7r"><rt id="epa7r"><rt id="epa7r"></rt></rt><noframes id="epa7r"><rt id="epa7r"><delect id="epa7r"></delect></rt> <rt id="epa7r"><rt id="epa7r"></rt></rt><bdo id="epa7r"></bdo><noframes id="epa7r"><noframes id="epa7r"><noframes id="epa7r"><rt id="epa7r"><rt id="epa7r"></rt></rt><delect id="epa7r"></delect>