[Skip to main content](#vessel-content)

#   Show price of variant

##

- **[bolando](/forum/user/38611-bolando "View bolando's Profile")**
- [![bolando's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/38611-bolando "View bolando's Profile")
- [ Offline](/forum/user/38611-bolando)

Less More

- Posts: 91
- Thank you received: 5
-
-

9 years 4 months ago -  9 years 4 months ago [\#272000](#272000) by [bolando](/forum/user/38611-bolando "View bolando's Profile")  Replied by *[bolando](/forum/user/38611-bolando "View bolando's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#272000 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

Hey,

I was also looking for an option to show price of a variant and after some trying I found out that this code works:
In file
/administrator/components/com_hikashop/types/characteristic.php
line about 227
instead of Code:

$values[$k] = $value-&gt;characteristic_value;

put: Code:

foreach($element-&gt;variants as $variant){ foreach($variant-&gt;characteristics as $variantCharacteristic){ if($variantCharacteristic-&gt;characteristic_id==$value-&gt;characteristic_id){ $cenaWariantu = $variant-&gt;prices[0]-&gt;price_value_with_tax; $cena[] =sprintf("%01.2f", $cenaWariantu); } } } $values[$k]=$value-&gt;characteristic_value." - PLN ".$cena[$k-1];

Works at least for me.

But I also know that after HikaShop upgrade I will lose it. Is there a chance to implement this option by HikaShop Team?

Last edit: 9 years 4 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86316
- Thank you received: 14276
-
-

9 years 4 months ago [\#272054](#272054) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#272054 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

Hi,

We're thinking about doing something but it's a complex issue. Most of the time, you don't want the price there. Especially, since it can only work with one characteristic on the products. But even with only one characteristic, there are many cases when you don't want to display the price there.
We'll have to figure out something but we try to avoid adding too many options.
In fact, we're thinking of redoing the whole characteristic system in order to be ajax like we did with HikaShop 3 and the cart/checkout system. So when we do, we'll make sure that you can override the display properly.
But that won't happen in the short term.
For now, you'll have to keep your hack of the core or develop a small class override plugin to override the whole class of the file to have your change taken into account.
Here is a thread where we talk about class overrides:
[ www.hikashop.com/forum/2-general-talk-ab...custom-features.html](https://www.hikashop.com/forum/2-general-talk-about-hikashop/28425-overriding-hikashop-classes-for-custom-features.html)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[bolando](/forum/user/38611-bolando "View bolando's Profile")**
- [![bolando's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/38611-bolando "View bolando's Profile")
- [ Offline](/forum/user/38611-bolando)

Less More

- Posts: 91
- Thank you received: 5
-
-

9 years 4 months ago [\#272686](#272686) by [bolando](/forum/user/38611-bolando "View bolando's Profile")  Replied by *[bolando](/forum/user/38611-bolando "View bolando's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#272686 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

Hey,

I am trying to create a plugin as you said.
Can you take a look at the code?
[ github.com/bolando/plg\_hika\_char\_prices/](https://github.com/bolando/plg_hika_char_prices/)
Is the logic OK?
It doesn't seem to work now.

The following user(s) said Thank You: [trevsmiff](/forum/user/9214-trevsmiff "View trevsmiff's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86316
- Thank you received: 14276
-
-

9 years 4 months ago [\#272694](#272694) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#272694 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

Hi,

Change the class name to hikashopCharacteristicTypeOverride and it should be taken into account by HikaShop automatically.
You can add temporarily an exit; at the beginning of the load function just to make sure that your override class is used by HikaShop.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[thschuler](/forum/user/51409-thschuler "View thschuler's Profile")**
- [![thschuler's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/51409-thschuler "View thschuler's Profile")
- [ Offline](/forum/user/51409-thschuler)

Less More

- Posts: 4
- Thank you received: 0
-
-

9 years 3 months ago [\#273835](#273835) by [thschuler](/forum/user/51409-thschuler "View thschuler's Profile")  Replied by *[thschuler](/forum/user/51409-thschuler "View thschuler's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#273835 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

Hi bolando,
your code nearly worked for me.
I had to change $cena[ ] to $cena in both lines, and then it worked.
Why did you make $cena[ ] and array?

Thanks
Thomas

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[bolando](/forum/user/38611-bolando "View bolando's Profile")**
- [![bolando's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/38611-bolando "View bolando's Profile")
- [ Offline](/forum/user/38611-bolando)

Less More

- Posts: 91
- Thank you received: 5
-
-

9 years 3 months ago [\#273890](#273890) by [bolando](/forum/user/38611-bolando "View bolando's Profile")  Replied by *[bolando](/forum/user/38611-bolando "View bolando's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#273890 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

I am not a good coder, so maybe your code is better. I am glad that it works.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[savvygents](/forum/user/49684-savvygents "View savvygents's Profile")**
- [![savvygents's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/49684-savvygents "View savvygents's Profile")
- [ Offline](/forum/user/49684-savvygents)

Less More

- Posts: 5
- Thank you received: 0
-
-

8 years 4 months ago -  8 years 4 months ago [\#293628](#293628) by [savvygents](/forum/user/49684-savvygents "View savvygents's Profile")  Replied by *[savvygents](/forum/user/49684-savvygents "View savvygents's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#293628 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

I just found this post. I have followed all of your suggestion but it did not work. Am I missing some thing? Code:

foreach($element-&gt;variants as $variant){ foreach($variant-&gt;characteristics as $variantCharacteristic){ if($variantCharacteristic-&gt;characteristic_id==$value-&gt;characteristic_id){ $cenaWariantu = $variant-&gt;prices[0]-&gt;price_value_with_tax; $cena=sprintf("%01.2f", $cenaWariantu); } } } $values[$k]=$value-&gt;characteristic_value." - PLN ".$cena;

Last edit: 8 years 4 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86316
- Thank you received: 14276
-
-

8 years 4 months ago [\#293632](#293632) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#293632 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

Hi,

If you want to have the price added to the variants, you can just change the code: Code:

$values[$k] = $value-&gt;characteristic_value;

to: Code:

$currencyHelper = hikashop_get('class.currency'); $values[$k]=$value-&gt;characteristic_value.' ('.$currencyHelper-&gt;format($element-&gt;variants[$value-&gt;variant_product_id]-&gt;prices[0]-&gt;price_value,$element-&gt;variants[$value-&gt;variant_product_id]-&gt;prices[0]-&gt;price_currency_id).')';

in that file administrator/components/com_hikashop/types/characteristic.php and that should do it.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[BluepointWebdesign](/forum/user/34929-bluepointwebdesign "View BluepointWebdesign's Profile")**
- [![BluepointWebdesign's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34929-bluepointwebdesign "View BluepointWebdesign's Profile")
- [ Offline](/forum/user/34929-bluepointwebdesign)

Less More

- Posts: 424
- Thank you received: 11
-
-

4 years 9 months ago [\#338717](#338717) by [BluepointWebdesign](/forum/user/34929-bluepointwebdesign "View BluepointWebdesign's Profile")  Replied by *[BluepointWebdesign](/forum/user/34929-bluepointwebdesign "View BluepointWebdesign's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#338717 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

hi,

This gives the variants value and only price (€ 0,00) behind all the variants..
or am i missing something?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86316
- Thank you received: 14276
-
-

4 years 9 months ago [\#338719](#338719) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#338719 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

Hi,

This won't work anymore as we moved things around.
You now have to change the line: Code:

$values[$k] = $value-&gt;characteristic_value;

in the file show_block_characteristic via the menu Display&gt;Views and replace it by: Code:

$values[$k]=$value-&gt;characteristic_value.' ('.$this-&gt;currencyHelper-&gt;format($this-&gt;element-&gt;variants[$value-&gt;variant_product_id]-&gt;prices[0]-&gt;price_value,$this-&gt;element-&gt;variants[$value-&gt;variant_product_id]-&gt;prices[0]-&gt;price_currency_id).')';

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[BluepointWebdesign](/forum/user/34929-bluepointwebdesign "View BluepointWebdesign's Profile")**
- [![BluepointWebdesign's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34929-bluepointwebdesign "View BluepointWebdesign's Profile")
- [ Offline](/forum/user/34929-bluepointwebdesign)

Less More

- Posts: 424
- Thank you received: 11
-
-

4 years 9 months ago [\#338803](#338803) by [BluepointWebdesign](/forum/user/34929-bluepointwebdesign "View BluepointWebdesign's Profile")  Replied by *[BluepointWebdesign](/forum/user/34929-bluepointwebdesign "View BluepointWebdesign's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#338803 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

Did what you said but still get the (€0,00) after each variant.. or do i miss something.?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

4 years 9 months ago [\#338808](#338808) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#338808 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

Hello,

Can you check via "Hikashop-&gt;Display-&gt;Views" that you have edited the "show_block_characteristic" file of the "product" view of your **front-end template** that you are currently using on your website :
[ www.hikashop.com/support/documentation/1...-display.html#layout](https://www.hikashop.com/support/documentation/153-customize-the-display.html#layout)

Kind regards,
Mohamed.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[BluepointWebdesign](/forum/user/34929-bluepointwebdesign "View BluepointWebdesign's Profile")**
- [![BluepointWebdesign's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/34929-bluepointwebdesign "View BluepointWebdesign's Profile")
- [ Offline](/forum/user/34929-bluepointwebdesign)

Less More

- Posts: 424
- Thank you received: 11
-
-

4 years 9 months ago [\#338841](#338841) by [BluepointWebdesign](/forum/user/34929-bluepointwebdesign "View BluepointWebdesign's Profile")  Replied by *[BluepointWebdesign](/forum/user/34929-bluepointwebdesign "View BluepointWebdesign's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#338841 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

Hi,
I editted the right view..
Just checked it.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86316
- Thank you received: 14276
-
-

4 years 9 months ago [\#338865](#338865) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Show price of variant](/forum/4-how-to/27065-show-price-of-variant?start=20#338865 "Hi Nicolas,  Is it possible to show the price of a product's variants along with the variant name?  I have a product that has many variants which are sizes. Each size has it's own price.  I have set the variants to show as a dropdown box but only the variant name shows in the box so the user does not know the price of each variant until it is selected.  I don't particularly want to set all the variants up as products.  I have tried displaying the variants as a &quot;table&quot; but this does not seem to change anything.  Just wondering if there is any quick way of showing the variant prices?  cheers!")*

Hi,

I checked the code and did some debugging and the issue is that the variants array keys are modified before reaching the view file to sort them based on the order configured in the shop while it's not yet the case in the location where the code was to be modified in old versions of HikaShop.
This means that the code needs to be a bit more complex, like this: Code:

$current = null; foreach($this-&gt;element-&gt;variants as $variant){ if($variant-&gt;product_id == $value-&gt;variant_product_id) $current = $variant; } $values[$k]=$value-&gt;characteristic_value.' ('.$this-&gt;currencyHelper-&gt;format($current-&gt;prices[0]-&gt;price_value,$current-&gt;prices[0]-&gt;price_currency_id).')';

I successfully tested this code on my end.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzI3MDY1LXNob3ctcHJpY2Utb2YtdmFyaWFudD9zdGFydD0yMCZ0bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.210 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
