Cart Upload with product targeting

Product targeting on the upload field only works on the Product detail page. 

If you need to show an upload field on the Cart page based on the contents of the cart, please follow the steps below:

This setup requires the upload field to be placed manually as described here:
https://docs.cloudlift.app/article/4-how-can-i-show-the-widget-on-a-custom-page

The idea is to only add the upload container if the cart contains specific products, we can do this by using a custom liquid code that checks each product in the cart:

 {% for item in cart.items %}
         {% if item.product.tags contains 'personalized' %}
                <div class="upload-lift"></div>
          	{%- break -%}
         {% endif %}
{% endfor %}

The above code checks if a product contains a tag "personalized", you can modify the condition to anything you want to based on the product object. 

To target specific collection you can instead use this code:

{% for item in cart.items %}
         {% assign uploadAdded = false %}
         {% for c in item.product.collections %}
              {% if c.handle == 'picture-frames' %}
                   <div class="upload-lift" ></div>
                   {% assign uploadAdded = true %}
                   {%- break -%}
             {% endif %}
         {% endfor %}  
         {% if uploadAdded %}{%- break -%}{% endif %}                                                                                      
{% endfor %}

This code should be added at your desired location on the cart page:

In the Shopify Admin theme editor, navigate to  Online Store > Themes,  [More actions] > Edit Code.

in your  cart-template.liquid file  add the code before somewhere between the "<form>..</form>" tag. 

If you need further assistance, please send us a request and we will be happy to help you out. 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.