如何检查产品是否存在于 Shopify 的购物车中

问题描述

我想在购物车窗口中显示推荐产品。

下面是代码-

{%- if cart.item_count > 0 -%}
  {%- assign product_image_size = '800x1026' -%}
  {% for product in collections[settings.product_upsell_collection].products limit:settings.product_upsell_limit %}
     {%- for item in cart.items -%}
         {%- if item.product.handle != product.handle -%}
             {%- assign product_show = 'no' -%}

             //Other html product markup

         {%- endif -%}
     {% endfor %}
  {% endfor %}       
{%- endif -%}

我面临的问题是购物车中已有的产品也出现在推荐中。

解决方法

我更愿意:

(df2['date'] - df2['competition_since']).apply(lambda x: x.days)