Mini-cart-item-wrapper showing unwanted data from Product Options By Bold App

Solved
Highlighted
New Member
3 0 0

Hello!

 

We do our product customization through an app called "Product Options by Bold" and some unwanted information is showing up for personalized items when you hover over the "Cart" tab (See below). I want to keep the "Text" field showing and get rid of the other two lines marked in red. These lines do not show up once you actually click on cart.

 Cart Checkout Issue.JPG

The code where this issue is happening (Mini-cart.liquid) looks like this on the back end:

 </p>

          {% if item.properties %}
            {% for property in item.properties %}
              {% unless property.last == blank %}
                <p class="mini-cart-item-property">
                  <span class="property-label">{{ property.first }}:</span>
                  {% if property.last contains '/uploads/' %}
                    <a class="property-image" href="{{ property.last }}">{{ property.last | split: '/' | last }}</a>
                  {% else %}
                    <span class="property-value">{{ property.last }}</span>
                  {% endif %}
                </p>
              {% endunless %}
            {% endfor %}
          {% endif %}

If anyone could let me know how to change the code so that this stops showing that would be great!

0 Likes
Tourist
8 1 1

It seems that the for loop is reading every single property in the item and its value, including the _boldOptionLocalStorageId and its value.

 

The quick way to fix it is to have the code ignore it in the for loop. The other way is to just rewrite it without the for loop and only display the fields that you want to show in the cart. But it depends on how the code is written.

0 Likes
New Member
3 0 0

Ok so is there a command to insert into a certain area of this code to bypass the second item.properties in the mini-cart?

0 Likes

Success.

Tourist
8 1 1

If it was up to me, I'd ditch the for loop and list out only the attributes that I want to display.

 

For instance, assuming property had the following attributes: Qty, Title, Text, Price. I'd just display those in the <span class="property-label"> and <span class="property-value">

 

If you need a quick and dirty way, try something like this:

 

          {% if item.properties %}
            {% for property in item.properties %}
              {% unless property.last == blank or property.first contains '_boldOptionLocalStorageId' %}
                <p class="mini-cart-item-property">
                  <span class="property-label">{{ property.first }}:</span>                  {% if property.last contains '/uploads/' %}
                    <a class="property-image" href="{{ property.last }}">{{ property.last | split: '/' | last }}</a>
{% elsif property.last contains '' {% else %} <span class="property-value">{{ property.last }}</span> {% endif %} </p> {% endunless %} {% endfor %} {% endif %}

I did not test the code, but logic is if property.first contains _boldOptionLocalStorageId just skip it.

 

Hope it works. 

1 Like