How to auto-add products based on spending tiers in cart?

I am trying to add a product to cart automatically based on spending tiers. The first tier is the one I am having an issue with because I am adding a product with 2 variants and the code I have is not correctly accounting for if the product is already in the cart.

{% assign lineItemProductIDs = cart.items | map:line_item.product_id %}
{% if cart_total >= 3900 and cart_total < 12900 %}
{% if lineItemProductIDs == ‘555555’ %}

This cart already contains 555555 {% else %} {% assign queue = '[{ variant_id: 123456, quantity_id: 1 }]' %} {% endif %} {% elsif cart_total >= 12900 %}

to clarify, if I have multiple other products in the cart, then this will not trigger as though product 555555 is already in the cart. Im assuming that it is not looping through the whole cart correctly and if it finds a product that doesn’t match, then it moves on to else

Figured it out with the help of this post and added the fix there:

https://community.shopify.com/c/shopify-design/if-and-elsif-else-statements-for-multiple-conditions/m-p/1475617