[Skip to main content](#vessel-content)

#   How to add 'additional weight' to an order?

##

- **[praes](/forum/user/5655-praes "View praes's Profile")**
- [![praes's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/5655-praes "View praes's Profile") Topic Author
- [ Offline](/forum/user/5655-praes)

Less More

- Posts: 44
- Thank you received: 2
-
-

3 years 6 months ago -  3 years 6 months ago [\#350897](#350897) by [praes](/forum/user/5655-praes "View praes's Profile")  *[How to add 'additional weight' to an order?](/forum/27-checkout/906232-how-to-add-additional-weight-to-an-order#350897 "-- HikaShop version -- : 4.7.2 -- Joomla version -- : 4 -- PHP version -- : 8.1  Hi,  Have a question regarding product weight and total order weight. Using Hikashop Business.  Use case: all our products do have a weight. With each product, I have a custom field. By default, it is set to 1. Maximum is 7. Each value chosen should add a certain weight times the chosen value, let's say 40 grams, to the product. So if the custom field contains the value 3, a total of 120 grams must be added to the weight of the order. If the product weight was already 100 grams, the total weight of the product in the cart has to be 100 + 120 = 220 grams. How can I achieve this?  For reasons I cannot use product variants or options. It has to be done through this custom field.  Any suggestion in the right direction is much appreciated!  Thanks, Jelger")* was created by *[praes](/forum/user/5655-praes "View praes's Profile")*

-- HikaShop version -- : 4.7.2
-- Joomla version -- : 4
-- PHP version -- : 8.1

Hi,

Have a question regarding product weight and total order weight. Using Hikashop Business.

Use case: all our products do have a weight. With each product, I have a custom field. By default, it is set to 1. Maximum is 7. Each value chosen should add a certain weight times the chosen value, let's say 40 grams, to the product. So if the custom field contains the value 3, a total of 120 grams must be added to the weight of the order. If the product weight was already 100 grams, the total weight of the product in the cart has to be 100 + 120 = 220 grams. How can I achieve this?

For reasons I cannot use product variants or options. It has to be done through this custom field.

Any suggestion in the right direction is much appreciated!

Thanks, Jelger

Last edit: 3 years 6 months ago by [praes](/forum/user/5655-praes "View praes's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkwNjIzMi1ob3ctdG8tYWRkLWFkZGl0aW9uYWwtd2VpZ2h0LXRvLWFuLW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86290
- Thank you received: 14268
-
-

3 years 6 months ago [\#350899](#350899) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to add 'additional weight' to an order?](/forum/27-checkout/906232-how-to-add-additional-weight-to-an-order#350899 "-- HikaShop version -- : 4.7.2 -- Joomla version -- : 4 -- PHP version -- : 8.1  Hi,  Have a question regarding product weight and total order weight. Using Hikashop Business.  Use case: all our products do have a weight. With each product, I have a custom field. By default, it is set to 1. Maximum is 7. Each value chosen should add a certain weight times the chosen value, let's say 40 grams, to the product. So if the custom field contains the value 3, a total of 120 grams must be added to the weight of the order. If the product weight was already 100 grams, the total weight of the product in the cart has to be 100 + 120 = 220 grams. How can I achieve this?  For reasons I cannot use product variants or options. It has to be done through this custom field.  Any suggestion in the right direction is much appreciated!  Thanks, Jelger")*

Hi,

I think you'll have to create a small custom plugin. In it, you'll want to implement the onAfterOrderCreate and onAfterOrderUpdate event ( [ www.hikashop.com/support/documentation/6...mentation.html#order](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#order) ).
In these, you'll want to:
- Run a MySQL query based on the order_id to load the products in the hikashop_order_product table and then their corresponding data in the hikashop_product table
- based on order_product_quantity in hikashop_order_product and your product custom field value in hikashop_product, you can update the order_product_weight in the hikashop_order_product table with a MySQL query
- you can also recalculate the total and set the order_weight in the hikashop_order table with a MySQL query.
Beware of NOT using the save function of class.order to save the new total weight in the order as you would create an infinite loop since the save function will then trigger the onAfterOrderUpdate event.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkwNjIzMi1ob3ctdG8tYWRkLWFkZGl0aW9uYWwtd2VpZ2h0LXRvLWFuLW9yZGVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.144 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
