Both code snippets in this download folder enable you to show a specific custom field based on the total weight of all products in the cart on the WooCommerce checkout page.
- By default, the code is written to show a custom field named Up To 500 kg when the weight is 500 kg or less. Other fields will not display.
- When the weight is over 500 kg or less than 1001 kg a field named Over 500kg & Less Than 1001kg displays and all other fields are hidden.
- When the total weight in the cart is more than 1000 kg, a field named Over 1000 kg is shown and all other fields are hidden.
The custom field value is output on the WooCommerce > Orders > Edit Order screen like this under the shipping details :
Copy & paste the PHP code from the functions.php or functions 2.php file to the end of your child themes functions file or custom functionality plugin.