Us   Eu   Au Get in touch

Removing the 'No additional Charge' or price addition from a custom filed cart variant dropdown

Joomla's popular ecommerce extension, Virtuemart allows us to add variants of products and charge extra for those variants. You may have products that carry no additional charge such as different colors available, and by default Virtuemart will display a 'No additional Charge' message in the dropdown where your customer selects that variant. In this article we show you how to not display those extra prices or messages.

Removing the 'No additional charge'

The best way to achieve this is to add a langiage override. Language overrides allow us to replace any string constant declared in any of the language files with a custom version. In this case we want to replace the string value of 'No additional charge' with a blank, empty value.

To do that, in Joomla administrator we navigate to Extensions > Language(s) > Overrides. Click New to create a new language override. In the search, lookup the constant value for the string 'No additional charge' and it should show you 'COM_VIRTUEMART_CART_PRICE_FREE No additional charge' as the result. Clicking the results will prefill the override area on the left and you can then delete the content in the 'Text' field and save it. You have now created a language override replacing the string 'No additional charge' with an empty value, preventing it from displaying in your Virtuemart online shop.

This method uses the Langage Override system in Joomla so it will not get overwritten when an update happens.

Removing the No Additional Charge text from Cart Variant Dropdown in Virtuemart

Removing the price addition

To remove the additional price displayed in the dropdown of cart variants, we need to edit a core file that can not be currently done usng the override system. This means that when an update changes this file at some point in the future, our change will be overwritten and we will need to do this action again to achieve the desired result.

The file to be edited is administrator\components\com_virtuemart\models\customfields.php and in the current version of Virtuemart (v3.2.4) the line to edit in that file is 913. Alter or replace the line $price ="+".$price; to $price =""; Again, here we are effectively replacing the $price variable with a blank string so it does not display the additional price. The results of this alteration will be seen as in the screenshot below.

Removing the additional price in Virtuemart cart variant dropdown

 Once you have made the change and replaced the file on your system, you should see the desired result. Remember, this is not an override so make a note of your change so that you can re-implement this after the next Virtuemart update.

Last modified onSunday, 02 December 2018 12:13

Contact us

Need a Joomla Expert?