This is a Virtuemart 2 plugin that lets the user add a custom amount to the price of a product, or lets the user completely give the amount they want to pay for a product. It will display an input box for the amount next to the "Add to Cart" button:

Typical use cases are:

Sell vouchers where the buyer determines the amount

Let users add a custom donation amount the product's price

Let a user completely define the price of a product

The plugin configuration also allows to specify an upper and/or lower limit for the amount to be added to the price. If the user enters an amount outside this range, the limit will be used instead and a warning message printed.

The amount added to the price will not be handled or displayed separately from the product price, but will directly change the product's price. In particular, it will get the same tax as the original base price of the product.

Configuration & How the plugin works

First, install the plugin with Joomla's extension manager. It will automatically be enabled.

Now, set up a Custom Field ("Products" -> "Custom Fields"):

Create a new field (the green + button in the top right corner)

Select "Plug-ins" as Custom Field Type

Enter the title (will be shown in front of the price input box)

Set "Cart Attribute" to "Yes"

In VirtueMart 3 and above, you also need to set "Cart Input" to "Yes" (to make VM show the price input control!)

Select "VM Name the Price" as the plugin

Now you can add this custom field to any product you like:

Open the product in the VirtueMart backend, go to the "Custom Fields" tab and add the field you just created. There you can also add a maximum or minimum value allowed for the added amount. In particular, the default lower value of 0.0 prohibits entering discounts. If you remove the lower bound, the user can also enter a negative value and thus reduce the price. If the user enters a price modifier (donation) that is outside the allowed range, the closest value inside the range will be used (e.g. if the upper bound is 100 and the user enters 9999, a value of 100 will be added). VirtueMart 3.x will also print a warning in this case (VM 2 did not provide any way to print such a warning).

To sell a product with a fixed price and an optional additional donation, simply set the price for the product and add this custom field.

To let the user completely specify the price of a product, set the product's price to 0.00001 (not 0, since then no "Add to cart" button will be displayed!) and add this custom field.

The product page will now display an entry box, where the user can enter the donation amount they want to add to the product price:

The cart (and the order confirmation and the invoice) will also display the donation amount that the user entered:

License

This plugin is licenced unter the GNU GPLv3. It is also free to download, and you automatically obtain all the rights and duties that the GPL gives you, without any payment. If you find the plugin useful, it would still be nice if you could donate a certain amount.

Frequently Asked Questions (FAQ)

1) Which PHP, Joomla and VirtueMart versions does the plugin work with

I am developing the plugin with PHP 5.3 and 5.4 on Joomla 2.5 with VirtueMart 2.0. Recently, I have switched to PHP 5.5 on Joomla 3.4 with Virtuemart 3.x.

Other combinations might work, but I have not had any reports (neither success nor failure). If you are using the plugin on a different combination of versions, please let me know whether it works or not.

2) Can you please implement [...]?}

I'm always open for good suggestions and ideas concerning the plugin's functionality. However, as my time is really limited, I cannot promise anything. Currently, the following ideas are on my list:

Add option to allow/disallow negative values(Implemented in Version 1.1)

Add option for maximum/minimum allowed value(Implemented in Version 1.1)

Try to find a way to let the donation amount be untaxed (will probably not be possible, though)

I have no idea when I will be able to implement these ideas. If you really need any feature urgently, please feel free to ask me for a quote for custom development. All commissioned features will of course be made available to all other plugin users, too, if they are useful to the general public.

Source Code and Contributing

To contribute to the project, feel free to send me patches or pull requests for this GitHub repository.

Version History

2016-01-01: Version 1.5 (Implement automatic updates through the Joomla updater)2015-10-10: Version 1.4 (When lower bound is configured, immediately update the product to that bound when the page is loaded)2015-04-04: Version 1.3 (Fix php warning; properly include GPL license files)2014-11-25: Version 1.2 (Update to Joomla 3.x and VirtueMart 3.x; Renamed to "Name the Price")2013-11-15: Version 1.1 (add upper/lower limit for the entered value)2013-03-02: Version 1.0 (First release)