My friend (and awesome fellow at WooThemes) Gerhard wrote a few months ago a really nice snippet to add a new column in the WordPress administration edit order page to display the order weight. This snippet is really great but the order total weight will not be fully accurate if you change a product weight because the snippet calculates the order weight on the fly.
Let’s say a user buys product A, which weight is 10 on july 15th. User A purchases this product on the same day. But a week later you get a new version of product A that is slightly less heavy. You then edit product A weight and set it to 9. Gerhard’s snippet will display user’s A order total weight equal to 9. But if you send user A product former version of product A (the one that user A purchased) the right weight is 10, not 9. Does that makes sense?
So, in order to avoid this, i coded a quick snippet that saves the total order weight at the exact moment the order is made. The snippet then adds a new column in the orders list that displays the correct weight with the weight unit defined in WooCommerce settings. Simply place that code in functions.php in your theme folder:
Here is the result:

Leave a Reply
You must be logged in to post a comment.