I'm in a unique situation with my Woocommerce site.
I need to add a packaging fee, which will be somewhat similar to a handling fee.
Unfortunately, it's not as simple as adding a $5.00 handling fee to every order.
Since I sell wood products based on their measurements (width x height), the packaging fees are based on the total square footage for items. And they can differ depending on the category of the items, as well.
I've done a ton of research and I can't find a plugin to handle this situation.
To add to the complexity, there's a whole table that would need to be created. For example, if items from one category have a total square footage between 1-10, then the packaging fee will be $10. If total sq ftg is between 11-20, then it'll be $20.
How can I do to achieve that?
Thanks
This is possible and easy with the
add_fee()
method in thewoocommerce_cart_calculate_fees
hook. Here is a simple usage example for simple products, with 2 categories and based on the product dimensions measurement calculations for each item of the cart. Its also possible for other product types.Here is the example code (That you will need to customize for your own case):
Code goes in function.php file of your active child theme (or theme). Or also in any plugin php files.
The code is tested and fully functional.
Related Answers: