Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
99 Vistas

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
Mejor respuesta

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
Publicaciones relacionadas Respuestas Vistas Actividad
2
dic 23
2587
1
oct 23
2756
4
oct 23
5428
2
oct 24
3446
1
abr 23
2340