WooCommerce: Fix Shipping Calculation Issue
Budget: $10 – $30 USD
I am experiencing an issue with a custom WooCommerce shipping plugin where selecting the "Rush Shipping" option does not update the cart total despite successful AJAX requests.
Current Setup
Custom Shipping Plugin:
-Calculates shipping costs based on postal codes stored in a custom table (wp_riffaz_ss_cities).
- Offers two shipping options: Normal and Rush (with an express fee).
- Uses AJAX to update shipping costs when the user selects Rush Shipping.
Problem:
- When switching to Rush Shipping, the AJAX request succeeds (confirmed in logs), but:
- Shipping cost does not update in the checkout UI.
- Cart total remains unchanged.
- Console logs show no errors, but the totals are not recalculated.
Identify why shipping costs and cart totals fail to update despite valid AJAX responses.
Ensure WooCommerce’s update_checkout trigger properly recalculates totals.
Verify session data persistence between AJAX requests and checkout reloads.
Check JavaScript event handling for radio button changes.
Deliverables
Working Solution:
- Shipping and cart totals update immediately when switching between Normal/Rush options.
- No console errors or PHP warnings.
- Summary of the root cause and steps taken to resolve it.
- Instructions for testing the fix.
- Product has a meta custom field vendor. if the cart has product from more than 1 total shipping cost should be multiplied by the number of vendors. (we can easily get the number of vendors using the custom field)
Code Comments:
- Add explanatory comments to critical sections of the code.
Current Setup
Custom Shipping Plugin:
-Calculates shipping costs based on postal codes stored in a custom table (wp_riffaz_ss_cities).
- Offers two shipping options: Normal and Rush (with an express fee).
- Uses AJAX to update shipping costs when the user selects Rush Shipping.
Problem:
- When switching to Rush Shipping, the AJAX request succeeds (confirmed in logs), but:
- Shipping cost does not update in the checkout UI.
- Cart total remains unchanged.
- Console logs show no errors, but the totals are not recalculated.
Identify why shipping costs and cart totals fail to update despite valid AJAX responses.
Ensure WooCommerce’s update_checkout trigger properly recalculates totals.
Verify session data persistence between AJAX requests and checkout reloads.
Check JavaScript event handling for radio button changes.
Deliverables
Working Solution:
- Shipping and cart totals update immediately when switching between Normal/Rush options.
- No console errors or PHP warnings.
- Summary of the root cause and steps taken to resolve it.
- Instructions for testing the fix.
- Product has a meta custom field vendor. if the cart has product from more than 1 total shipping cost should be multiplied by the number of vendors. (we can easily get the number of vendors using the custom field)
Code Comments:
- Add explanatory comments to critical sections of the code.