Calculate product weight based on size
-
I’m making a website that sells customized PVC banners.
The user can customize the size (width x height) and a couple of other options (2 checkboxes). Every measure from 1m x 1m and up (no limits to the size) is accepted. I’m calculating the price for this with a plugin called Woo Price Calculator, and that works fine.
My problem comes with shipping. Obviously, the bigger the banner, the heavier it is. But, seeing as I can’t make infinite variations of the product (1,01m x 1m, 1,02m x 1m etc…) I need a way to calculate the weight of the product, before checkout, so I can apply my shipping rates to it.
So far I have no idea how to do this. I think I would need to add width, height and weight as attributes (they’re currently only variables used in Woo Price Calculator), somehow set them every time the user changes them, and then add a function to the add to cart button that calculates the weight of the product and changes the attribute. The only problem with this is that I don’t know a single thing about php or how WooCommerce attributes work, so I’m kind of stuck.
I’ve tried searching online but I haven’t found anyone with this problem, or a plugin made to solve it.
- The topic ‘Calculate product weight based on size’ is closed to new replies.