#1015 Showing price difference on options with variants

Posted in ‘Technical Support / Bugs’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

J2Commerce

Version
J2Commerce v6

Latest post by Olivier on Tuesday, 08 September 2026 16:44 UTC

Richard Gosler

When simple products have options with a price difference it shows clearly (which is good) such as this example: https://oromed.co.uk/oro-sleep-system/oro-advanced-latex-mattress but when using a flexible variant it doesn't (which is not good) as in this example: https://cjiclothing-com.stackstaging.com/schoolwear/the-bishop-of-winchester-academy/tbowa-boys-blazer

The larger sizes include VAT so are more expensive but the user needs to see that.

Richard Gosler

I used Codex to write an override file which i've attached in case you want to use it for a later release. See the result here: https://cjiclothing-com.stackstaging.com/schoolwear/the-bishop-of-winchester-academy/tbowa-boys-blazer

Olivier

Hello Richard,

I can see the change you made, but there was no attached file. No worries, here are my explanations:

for Simple / Configurable / Variable products:

option values carry an additive price delta. Every option template for these types (view_options.php, view_configurableoptions.php, view_variableoptions.php) renders (+ $X) next to each select/radio/checkbox value via ProductHelper::displayPrice(), and updates the running total live through doAjaxPrice(). This is consistent across all three of those types.

for Flexible Variants products:

options aren't priced deltas at all. Each full combination of option values maps to a distinct variant record with its own absolute price.

product_optionvalue_price isn't even part of the flexivariable variant admin form,  it's simply unused for this type. So view_flexivariableoptions.php never echoes a price next to option values.

Instead, once a full combination is selected, doFlexiAjaxPrice() -> onUpdateProduct() looks up the matching variant and updates the main price display for the page as a whole.

With flexible variants, a single option value ("Red" for instance) doesn't have one fixed price delta. Its effect on price depends on which variant combination it ends up part of. There's no single number to show next to "Red" in the dropdown the way there is for Simple/Configurable/Variable, where the value's price bump is fixed and independent of other selections.

Now that becomes a UX problem: before the customer has picked a full combination, flexible-variant shoppers get no per-option price hint at all (not even a range), unlike Simple-type shoppers who see the delta immediately per value.

Then the fix would be a "starting from" - style precompute per option value (min price across variants containing that value) rather than reusing product_optionvalue_price, since flexivariable doesn't populate that field.I was thinking of a 'on the fly' price calculation, but we can get into a performance hit if we recalculate the prices at every option change, especially if we have hundreds of combinations to check. 

This still would not come to the solution you applied to your products on the cjiclothing-com site. As I see it, the product used as an example may not be using the best appropriate product type, since there are no combinations of options to select from.

 

Olivier.

Growing Together

Help us get back to #1 in the Joomla Extension Directory by leaving us a 5-Star review here.

Stay Updated

Subscribe for free and be the first to know about the latest features, updates, and new additions.