News:

Looking for documentation? Take a look on our wiki

Main Menu

Price calculation with custom field and more then 1 quantity

Started by mohtashimj, June 18, 2019, 23:09:21 PM

Previous topic - Next topic

mohtashimj

I am also getting issue for my Virtuemart Store LIKE I have product price as $10 and custom field (for Set Up charges) created with price $50 and when user adding this products with quantity 10 then the products total price is calculating as $600 and which should calculate as $150 ($100 + $50) .
Please any one let me know if I can do that with the help of custom fields?

Studio 42

The price is always added for 1 product. So if you need to have same price for 10, you have to create a plugin which divides the price of the fields eg. for your case 50/10 in the plgVmPrepareCartProduct function.
This need to create your own product custom field.(i can do the work and some other devs here)

mohtashimj

Thank you for your reply.

I am also a developer. Can you please let me know what exactly I need to do with the plugin so that I can work on it and will make as I needed.

In my case for one product I have one custom field which need the price to apply only once if customer have more then 1 quantity ie 20 or 10 and will have one more custom field for which price will apply on all the quantity.

Please let me if that will possible from the way you are suggesting?

Studio 42

Check the core vmcustom textinput plugin, you have all the code.
You need to adapt plgVmPrepareCartProduct function ti charge the right price per quantity.