News:

Support the VirtueMart project and become a member

Main Menu

Change weight after changing selection from Custom field

Started by VMx, December 04, 2018, 00:24:42 AM

Previous topic - Next topic

VMx

I use product with weight information which is than used for shipping calculation. And the product has "2 versions" which user selects by drop down menu (custom field). Now the problem which I have is that if user selects second option I don't want them to pay for shipping, so I need to somehow set weight to 0 for that product when user selects specific value from custom field drop down. Does anyone know how/where to do that? Is it even possible or maybe if not on product page maybe I can check at checkout if product has custom field X, than change weight to 0...

GJC Web Design

if u use parent/childs ( multivariant) each selection is an ind. product and can have its own weight
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

balai


VMx

Yeah, I could solve this problem with child products, but my shop is very modified and a lot of other things would get broken with that. I must keep those 2 versions on selection box (because a lot of things rely on it - in basket, checkout, administration,...). That's the reason why I am searching for a way to change weight (and I will also need to change tax) for product after user selects another version or at least at checkout.

balai

I don't think that you can change weight on the fly. This is a database field and called also in the cart and checkout.

Btw. I don't understand what you mean with " must keep those 2 versions on selection box".
You can use "selection box" with child products as well.

VMx

So the best way than is to modify code for checkout, to check which version is selected and there change information. Or would it maybe be possible to pass parameter to add to cart button to change weight/tax?

By " must keep those 2 versions on selection box" I meant as I wrote- this can not be removed and if I use another drop down what's the point in having 2 drop downs with same selections? :) It would be very confusing for users. The only way I could do this is by hiding current drop down and than later change default (selected) value according to the product/child I am at. But that is same if not more work as to do other changes, and also I am not sure how other things (like bundles) would handle child products,...

Milbo

Of course there is a way, for example with the customsizeplugin
https://extensions.virtuemart.net/product/products/custom-size-detail

never hack the core, write plugins. There is a trigger for that. You can change anything in the product, also name, or so
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/