Giter Site home page Giter Site logo

Compare at price display about slate HOT 2 CLOSED

shopify avatar shopify commented on July 19, 2024
Compare at price display

from slate.

Comments (2)

NathanPJF avatar NathanPJF commented on July 19, 2024

Update: Other issues with compare at price display:

Compare at price on product page

The logic to display the compare_at_price is problematic. It is only checking the current variant compare_at_price. This means that if the current variant isn't on sale, we never get the necessary markup to handle displaying compare_at_price later.
Line:

{% if current_variant.compare_at_price_max > current_variant.price %}

The product.liquid page should be using the same logic as the featured_product section and checking the product compare prices. Then JS can handle displaying the compare at price.

Initial compare at price display

The markup for the featured product page is showing product.compare_at_price at the initial render - even when that compare_at_price has nothing to do with the selected variant.

Video: http://take.ms/C8Hnv

In the video, you can see that the variant Baby Blue / 8 / Suede is showing a compare at price initially. Problem: this variant is not on sale. When I switch variants and then switch back, the proper price is shown.

Solution: the initial render should be checking the current_variant inside of the product.compare_at_price check.

Example here
        {% if product.compare_at_price_max > product.price %}
          <span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
          <s data-compare-price>
            {% if current_variant.compare_at_price %}{{ current_variant.compare_at_price | money }}{% endif %}
          </s>
        {% endif %}
 

This will have to be considered for both the product template and the featured-product section.

Other issues

product.compare_at_price is undocumented.

from slate.

lock avatar lock commented on July 19, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from slate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.