Help beginner coder | item.final_price equals item_originalprice ? BUG?

I hope you’re having a good day so far! I’ve been on this for a couple hours now with a good friend of mine, and regardless what we try it returns the price of the sale. It does the same thing in checkout, what I display below is only in the “View Cart” stage before Initiating Checkout.

I started by trying to enable the display discount functionality in cart-template.liquid, and though it works the striked-out price is incorrect.

As you can see, the compare price is $10 higher than the price and @ cart screen it doesn’t show the correct compare at price ($89.99)

Below is the source code:

{%- assign hasDiscount = true -%}
                {%- if item.original_price != item.final_price -%}
                  {%- assign hasDiscount = true -%}
                {%- endif -%}

                
                  <dl>
                    {%- comment -%}
                      Markup template for discount item
                    {%- endcomment -%}
                    

                      <dt>
                        {{ 'products.product.regular_price' | t }}
                      </dt>
                      <dd>
                        ~~{{ item.original_price | money }}~~
                      </dd>
                      <dt>
                        {{ 'products.product.sale_price' | f }}
                      </dt>
                      <dd>
                        {{ item.final_price | money }}
                      </dd>
                    

                    {%- comment -%}
                      Markup template for regular price item
                    {%- endcomment -%}
                    
                      <dt>
                        {{ 'products.product.regular_price' | t }}
                      </dt>
                      <dd>
                        {{ item.original_price | money }}
                      </dd>
                    

                    {%- comment -%}
                      Markup template for unit price
                    {%- endcomment -%}
                    
                      <dt>
                        {{ 'products.product.unit_price_label' | t }}
                      </dt>
                      <dd>
                        
                          {%- capture unit_price_separator -%}
                            /{{ 'general.accessibility.unit_price_separator' | t }} 
                          {%- endcapture -%}
                          {%- capture unit_price_base_unit -%}
                            {%- if item.unit_price_measurement.reference_value != 1 -%}
                              {{- item.unit_price_measurement.reference_value -}}
                            {%- endif -%}
                            {{ item.unit_price_measurement.reference_unit }}
                          {%- endcapture -%}

                          {{ item.unit_price | money }}{{- unit_price_separator -}}{{- unit_price_base_unit -}}
                        
                      </dd>
                    

                  </dl>
                

Any help would be greatly appreciated!

Andrew

compare_at is not treated as a discount in the same way that an item discounted with a discount code is. You should something like item.variant.compare_at_price, not original_price in your equation for what you are trying to do.

That said, your code is actually working, but only items using discount codes.

You can think of the compare at system as indicating that an item is ‘on sale’, not ‘discounted’.

Sweet, thank you, that worked! What’s funny is I think I tried that, I just put it in the wrong line.

Would I be able to display the same thing in the checkout section? There it shows only the subtotal, too, and if it could work the same way it did in the cart that’d be fantastic.

Modifying checkout.liquid is only available on the plus plan, if you’re on that it should be doable.