Generate CSS if product in shopping cart has specific Tag (editing checkout.liquid)

Highlighted
Tourist
4 0 1

Hello,

We have products which are customized and cannot have expedited shipping applied to them.

If these products are in a user's shopping cart we want to hide the "expedited shipping" option at the shipping step of checkout.

I've been attempting to generate CSS if the products are present, but I cannot get it to work on checkout.liquid file.

The below does output CSS when in the cart-template.liquid file:

{% for item in cart.items %}
     {% if item.product.tags contains 'Personalize It' %}
     <style type="text/css">

     /* the content-box__row div is dynamically generated so I cannot add a class to it */

     div.content-box__row:nth-child(2) {

     display:none;

     }

     </style>
     {% endif %}
{% endfor %}

Any suggestions on how to execute this successfully in the checkout.liquid file?

Thanks. I appreciate your time.

1 Like
Highlighted
Shopify Partner
7485 1035 2600

Hello, @Windsinger 

Welcome to the Shopify community!
and Thanks for your Good question.

sorry for that checkout page customization allow to only Shopify plus plan

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Expert | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
0 Likes