Skip to Content
Menú
This question has been flagged
2 Respostes
107 Vistes

Is it possible, and if so how, to add a text label to the product reference price on the product and category pages?


When I add a product reference price I do get a strikethrough price on my website for the specific product. However under EU regulations I have to explain what the base price is. For example is it the MSRP, a previous price or something else. With the current product reference price I'm only getting the price value with a strike through.


I'm using Odoo v18 with Theme Prime.

Avatar
Descartar
Autor Best Answer

Hi,

Thanks. That worked.

Using Odoo Studio I was able to add a new field to the product form in the backend to add the new text field for the price description.

Then it was a bit of a search where to edit te price template to get it to show on the website. After enabling developer mode I had to go to: Settings -> Technical (top menu) -> Views (under User Interface). Then edit the template with the key "website_sale.product_price". 

Avatar
Descartar
Best Answer

Hi,


Yes, it’s possible to add a text label to the product reference price in Odoo 18, but it requires customizing the QWeb templates used for the website. By default, Odoo only displays the reference price as a strikethrough value without any explanation, which doesn’t meet the EU requirement to indicate the type of reference (e.g., MSRP, previous price).


Try the following steps


1-Create a custom field on product.template or product.product to store the reference price label, e.g., x_reference_price_label.


2-Activate Developer Mode → Go to Website → Configuration → Templates.


3-Inherit the product template (like website_sale.product) and modify the section that renders the reference price. For example, you can wrap the reference price with your new label:


<t t-if="product.lst_price">

    <span class="reference-price" t-att-title="product.x_reference_price_label">

        <t t-esc="product.lst_price"/>

    </span>

    <span class="reference-price-label" t-esc="product.x_reference_price_label"/>

</t>


4-Update the website and ensure the label appears under the strikethrough price.


This method lets you display both the reference price and a descriptive label explaining what it represents, making it compliant with EU regulations.


Hope it helps

Avatar
Descartar
Related Posts Respostes Vistes Activitat
2
de des. 23
2588
1
d’oct. 23
2757
4
d’oct. 23
5430
2
d’oct. 24
3452
1
d’abr. 23
2342