cancel
Showing results for 
Search instead for 
Did you mean: 

How to show FROM price on configurable products

SOLVED

How to show FROM price on configurable products

Hi,

 

How can i show FROM price on configurable products

 

Magento 2 displays base price set on configurable product as price on Category  pages and on product view page before attribute is selected. I would like to display either price range or show 'From' in front of the price, so it doesn't look like misleading, because the price changes when attribute is selected e.g. different price for different size.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to show FROM price on configurable products

How to apply a CSS rule on a frontend product view page to the configurable products only: https://mage2.pro/t/819

View solution in original post

6 REPLIES 6

Re: How to show FROM price on configurable products

The simpliest way to add a label (e.g. "FROM") before a price is to use the CSS rule ::before with setting the content property:

https://developer.mozilla.org/en/docs/Web/CSS/::before

https://developer.mozilla.org/en-US/docs/Web/CSS/content

Re: How to show FROM price on configurable products

Hi,

 

But How do you tell it to it for the configurable product only?

 

Thanks

Re: How to show FROM price on configurable products

How to apply a CSS rule on a frontend product view page to the configurable products only: https://mage2.pro/t/819

Re: How to show FROM price on configurable products

Very useful, thanks Dmitry.

 

Any idea how to do a similar exercise on a category page, I can't see any specific css class that identifies configurable products.

Re: How to show FROM price on configurable products

For the category page you could add the type of product to each product item as a class, this will require amending the product listing template. You can get the type ID via:

 

<?php echo $_product->getTypeId(); ?>
 
which will display e.g "configurable"

Re: How to show FROM price on configurable products

If you use CSS to add the text it won't be run through Magento's translate functions and won't be read by the likes of screen readers which causes an accessibility issue.