简体   繁体   English

如何在集合 SHOPIFY 中的产品下方添加“您添加了这个”

[英]How to add “you added this” bellow the product in the collection SHOPIFY

I'm sorry for this simple quistion but I really got a headache !对于这个简单的问题,我很抱歉,但我真的很头疼!

I need to add "You added this item" text bellow the product After adding to cart.添加到购物车后,我需要在产品下方添加“您添加了此商品”文本。

for example: I have a list of fruits.. when the client add 5 kilos from apple then back to the home page to check the other fruits.. He notice that he bought the apple product by adding "You added this item" text bellow the price.例如:我有一个水果清单.. 当客户从苹果中添加 5 公斤然后返回主页查看其他水果.. 他注意到他通过添加“您添加了这个项目”文本下面购买了苹果产品价格。在此处输入图像描述

thanks谢谢

Place the following code in a place where the product object is available on the homepage (or anywhere else).将以下代码放在主页(或其他任何地方) product object 可用的位置。

{%- assign productCartItems = cart.items | where: "product_id", product.id | size -%}
{%- if productCartItems > 0 -%}
  You added this item
{%- endif -%}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM