美狮贵宾会官网

美狮贵宾会官网(LianLian)官网首页

shopify购物车页面增长“持续购物”链接步骤

shopify购物车购物车链接
2022/03/07
自建站

购物车页面增长“持续购物”链接


备注

若是您使用 Shopify 的免费模板,,,您能够联系 Shopify 支持团队获得关于此教程的援手。。此教程必要 15 分钟的设计功夫。。若要相识详情,,,请参阅 Support for themes。。

备注

此自界说用于复古 Shopify 模板,,,不合用于“Online Store 2.0”模板。。

  • 找到您的模板架构版本

  • 索求“Online Store 2.0”模板自界说


您能够将持续购物链接增长到购物车页面,,,使客户在将产品增长到购物车后可轻松返回浏览产品。。您能够选择增长一个链接,,,用于将客户定向回目录页面、、您的主页或他们之前查看的最后一个产品系列页面。。

向购物车页面增长“持续购物”链接

若要向您的购物车页面增长持续购物链接,,,请执行以下操作:

PC:

  1. 在 Shopify 后盾中,,,转到在线商店 > 模板。。

  2. 找到要编纂的模板,,,而后点击操作 > 编纂代码。。

  1. 在 Sections 目录中,,,点击 cart-template.liquid。。若是您的模板中没有此文件,,,则点击 Templates 目录中的 cart.liquid。。

  2. 通过搜索 name="checkout" 的文件来查找结账按钮的代码。。结账按钮的代码行因模板而异,,,但会如下所示:

<button type="submit" id="checkout" name="checkout" class="btn">   {{ 'cart.general.checkout' | t }} </button>
  1. 下一步是粘贴新的代码行以创建持续购物链接。。您粘贴的代码将取决于您但愿链接转到的页面:

苹果系统:

  1. 在 Shopify 利用中,,,轻触商店。。

  2. 销售渠道部门中,,,轻触在线商店。。

  3. 轻触 Manage themes(治理模板)。。

  4. 找到要编纂的模板,,,而后点击操作 > 编纂代码。。

  1. 在 Sections 目录中,,,点击 cart-template.liquid。。若是您的模板中没有此文件,,,则点击 Templates 目录中的 cart.liquid。。

  2. 通过搜索 name="checkout" 的文件来查找结账按钮的代码。。结账按钮的代码行因模板而异,,,但会如下所示:

<button type="submit" id="checkout" name="checkout" class="btn">   {{ 'cart.general.checkout' | t }} </button>
  1. 下一步是粘贴新的代码行以创建持续购物链接。。您粘贴的代码将取决于您但愿链接转到的页面:

安卓系统:

  1. 在 Shopify 利用中,,,轻触商店。。

  2. 销售渠道部门中,,,轻触在线商店。。

  3. 轻触 Manage themes(治理模板)。。

  4. 找到要编纂的模板,,,而后点击操作 > 编纂代码。。

  1. 在 Sections 目录中,,,点击 cart-template.liquid。。若是您的模板中没有此文件,,,则点击 Templates 目录中的 cart.liquid。。

  2. 通过搜索 name="checkout" 的文件来查找结账按钮的代码。。结账按钮的代码行因模板而异,,,但会如下所示:

<button type="submit" id="checkout" name="checkout" class="btn">   {{ 'cart.general.checkout' | t }} </button>
  1. 下一步是粘贴新的代码行以创建持续购物链接。。您粘贴的代码将取决于您但愿链接转到的页面:

对于指向目录页面的链接

若要增长指向目录页面的链接,,,请将下方代码粘贴到结账按钮对应代码之前或之后的新行中:

<a href=/channel/"/collections/all" title="Continue shopping">Continue shopping</a>

对于指向主页的链接

若要增长指向您的主页的链接,,,请将下方代码粘贴到结账按钮对应代码之前或之后的新行中:

<a href="/" title="Continue shopping">Continue shopping</a>

对于指向上一个查看的产品系列的链接

若要增长指向上一个查看的产品系列的链接,,,请将下方代码粘贴到结账按钮对应代码之前或之后的新行中:

<a   id="continue-shopping"   href=""   title="Continue shopping">   Continue shopping </a>
  1. 点击保留。。若是您增长了指向目录页面或主页的链接,,,则操作已实现。。若是您增长了指向上一个查看的产品系列的链接,,,则必要向您的模板代码中增长一些 JavaScript。。而后持续依照后续步骤操作。。

  2. 在 Layout 目录中,,,点击 theme.liquid。。

  3. 在文件底部左近查找实现 </body> 象征。。将以下代码粘贴到实现 </body> 象征上方:

<script>   if(Storage !== undefined) {     var defaultLink = "/collections/all";     {% if template contains 'collection' %}       sessionStorage.collection = "{{ collection.url }}";     {% endif %}     {% if template contains 'cart' %}       if( !sessionStorage.collection ) {         sessionStorage.collection = defaultLink;       }       document.getElementById("continue-shopping").href = sessionStorage.collection;     {% endif %}     } </script>
  1. 点击保留。。

增长按钮形状(可。。

若是您使用免费的 Shopify 模板,,,则能够将形状利用于持续购物链接,,,使它出现按钮的外观。。通过向按钮链接的代码中增长类属性,,,您能够使您的按钮与模板中其他按钮的形状匹配。。所有免费 Shopify 模板都对主按钮形状使用一样的类名称,,,并且大无数此类模板对辅助按钮形状使用一样的类名称。。

若要向“持续购物”链接利用重要按钮形状,,,请执行以下操作:

将属性 class="btn" 增长到您已粘贴的代码行中,,,以便增长持续购物链接。。您的代码应如下所示:

<a href="/collections/all" title="Continue shopping" class="btn">   Continue shopping </a>

若要向“持续购物”链接利用辅助按钮形状,,,请执行以下操作:

备注:增长此类对 Boundless 没有影响。。

若是您使用的是 Supply 以外的免费模板,,,请将属性 class="btn--secondary" 增长到您已粘贴的代码行中,,,以便增长持续购物链接。。您的代码应如下所示:

<a href=/channel/"/collections/all" title="Continue shopping" class="btn--secondary">   Continue shopping </a>

若是您使用 Supply,,,请将属性 class="btn-secondary" 增长到您已粘贴的代码行,,,以便增长持续购物链接。。您的代码应如下所示:

<a href="/collections/all" title="Continue shopping" class="btn-secondary">   Continue shopping </a>

Shopify商户官网原文详情:

Add a continue shopping link to your cart


Note

If you use a free theme from Shopify, then you might be able to contact Shopify Support for help with this tutorial. It requires 15 minutes of design time. To learn more, refer to Support for themes.

Note

This customization is for vintage Shopify themes, and doesn't apply to Online Store 2.0 themes.

  • Find out your theme's architecture version

  • Explore Online Store 2.0 theme customizations


You can add a Continue shopping link to your cart page that allows customers to easily return to browsing products after adding something to the cart. You can choose to add a link that will take customers back to your catalog page, back to your home page, or back to the last collection page that they were looking at.

Add a Continue shopping link to your cart page

To add a Continue shopping link to your cart page:

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.

  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 code for the Checkout button by searching the file for name="checkout". The line of code for the checkout button varies theme to theme, but will look something like this:

    <button type="submit" id="checkout" name="checkout" class="btn">   {{ 'cart.general.checkout' | t }} </button>
  3. The next step is to paste a new line of code to create a Continue shopping link. The code that you paste will depend on which page you would like the link to go to:

    For a link that goes to your catalog page

    To add a link that goes to your catalog page, paste the following code on a new line either before or after the code for the Checkout button:

    <a href=/channel/"/collections/all" title="Continue shopping">Continue shopping</a>

iPhone:

  1. From the Shopify app, tap Store.

  2. In the Sales channels section, tap Online Store.

  3. Tap Manage themes.

  4. Find the theme you want to edit, and then click Actions > Edit code.

  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 code for the Checkout button by searching the file for name="checkout". The line of code for the checkout button varies theme to theme, but will look something like this:

    <button type="submit" id="checkout" name="checkout" class="btn">   {{ 'cart.general.checkout' | t }} </button>
  3. The next step is to paste a new line of code to create a Continue shopping link. The code that you paste will depend on which page you would like the link to go to:

    For a link that goes to your catalog page

    To add a link that goes to your catalog page, paste the following code on a new line either before or after the code for the Checkout button:

    <a href=/channel/"/collections/all" title="Continue shopping">Continue shopping</a>

Android:

  1. From the Shopify app, tap Store.

  2. In the Sales channels section, tap Online Store.

  3. Tap Manage themes.

  4. Find the theme you want to edit, and then click Actions > Edit code.

  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 code for the Checkout button by searching the file for name="checkout". The line of code for the checkout button varies theme to theme, but will look something like this:

    <button type="submit" id="checkout" name="checkout" class="btn">   {{ 'cart.general.checkout' | t }} </button>
  3. The next step is to paste a new line of code to create a Continue shopping link. The code that you paste will depend on which page you would like the link to go to:

    For a link that goes to your catalog page

    To add a link that goes to your catalog page, paste the following code on a new line either before or after the code for the Checkout button:

    <a href=/channel/"/collections/all" title="Continue shopping">Continue shopping</a>
  1. For a link that goes to your home page

    To add a link that goes to your home page, paste the following code on a new line either before or after the code for the Checkout button:

    <a href="/" title="Continue shopping">Continue shopping</a>

    For a link that goes to the last collection viewed

    To add a link that goes to the last collection viewed, paste the following code on a new line either before or after the code for the Checkout button:

    <a   id="continue-shopping"   href=""   title="Continue shopping">   Continue shopping </a>
  2. Click Save. If you added a link that goes to either your catalog page or your home page, then you are done. If you added a link that goes to the last collection viewed, then you will need to add some JavaScript to your theme code. Continue to follow the next steps.

  3. In the Layout directory, click theme.liquid.

  4. Find the closing </body> tag, near the bottom of the file. Paste the following code above the closing </body> tag:

    <script>   if(Storage !== undefined) {     var defaultLink = "/collections/all";     {% if template contains 'collection' %}       sessionStorage.collection = "{{ collection.url }}";     {% endif %}     {% if template contains 'cart' %}       if( !sessionStorage.collection ) {         sessionStorage.collection = defaultLink;       }       document.getElementById("continue-shopping").href = sessionStorage.collection;     {% endif %}     } </script>
  5. Click Save.

Add button styling (optional)

If you use a free Shopify theme, then you can apply styling to your Continue shopping link to make it look like a button. By adding a class attribute to the code for your button link, you can make your button match the style of the other buttons in your theme. All free Shopify themes use the same class name for primary button styles, and most use the same class name for secondary button styles.

To apply primary button styling to your Continue shopping link:

Add the attribute class="btn" to the line of code that you pasted to add a Continue shopping link. Your code should look like this:

<a href="/collections/all" title="Continue shopping" class="btn">   Continue shopping </a>

To apply secondary button styling to your Continue shopping link:


Note

Adding this class will not have an effect on Boundless.


If you use a free theme that is not Supply, then add the attribute class="btn--secondary" to the line of code that you pasted to add a Continue shopping link. Your code should look like this:

<a href=/channel/"/collections/all" title="Continue shopping" class="btn--secondary">   Continue shopping </a>

If you use Supply, then add the attribute class="btn-secondary" to the line of code that you pasted to add a Continue shopping link. Your code should look like this:

<a href="/collections/all" title="Continue shopping" class="btn-secondary">   Continue shopping </a>

文章内容起源:Shopify商户官方网站


更多
【网站地图】