Skip Navigation

[Resolved] Advice needed to add fees to WooCommerce products that are based on delivery zip

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Waqar 9 months, 3 weeks ago.

Assisted by: Waqar.

Author
Posts
#2679901

Tell us what you are trying to do? My client sells products within a territory of about 30 counties. These products are digital services including internet, telephone and television. I need to apply regulatory fees to each of those products and those fees are different for every zip code within the client's sales territory.

I need to figure out the best strategy for doing this for a collection of WooCommerce products. For each product to which fees apply, I need to determine the correct fee, using the customer's service address, and add those fees to WooCommerce orders.

Is there any documentation that you are following? N/A

Is there a similar example that we can see? N/A

What is the link to your site? N/A

I could create custom product fields to store the fees for each area within each product. I would need to add a process to iterate over products and include these fees as line items on WooCommerce orders.

Another approach would be to create all of the fees as individual products but classify them as such. Then I would need to scan WooCommerce orders for products subject to fees and then determine the correct fee based on customer service address and finally add those products to WooCommerce orders.

I am posting to see if anyone has worked on a problem like this and if anyone has any recommendations for the best approach.

#2679964

Hi,

Thank you for contacting us and I'd be happy to assist.

For the regulatory fees based on the customer's address, it would be best to use the WooCommerce tax calculation feature:
hidden link

This way you won't have to include any custom code or workarounds.

regards,
Waqar

#2680469

Thanks, Waraq. That approach makes sense. The system I need to submit order into does not, however.

The Toolset site will submit purchase orders into an external system that performs a lot of other, essential tasks for the client. That system treats all charges as products. So, for a given product, there will be another product for the particular tax in a particular location (county). There are also fees which are also stored in that system as products.

I need to be able to add these tax and fee "products" based on the source product and the service address. I will configure categories and then add the additional products to the cart as soon as I know where the service location is. I need to submit the correct product codes for products, taxes and fees. I know it seems clumsy, but it is necessary that both WordPress and the external site be operating on the same set of products.

If I can use JavaScript to add and remove items from the cart, I can place all fees and taxes into hidden <div>s on the page, then dynamically add and remove the correct fees and taxes as a user's location is updated.

Is there any recommended guide(s) for using JavaScript to manipulate cart items in this manner?

#2680811

Thank you for sharing further details.

I understand the unique requirement, but I'm a little skeptical about the approach of adding additional products to the cart. That is because the user can always remove the additional products from the cart, even if you've managed to add them automatically.

Have you considered using WooCommerce's grouped products feature?
( ref: hidden link )

If you could manage to sell those products only as grouped products and limit them so that they can't purchased individually, it should serve your requirements better.

For even more ideas and recommendations, you can also post this requirement at WooCommerce support and community forums.