This PHP code changes the product price on the cart and checkout pages based on which shipping method your customer chooses. All you need to do is set :
- The shipping zone I.D
- The new price based on your shipping I.D
In this example, we uses 2 prices. The 1st price is set at 4.64 Euros for local pickup which we’ve renamed pickup point 1 and 2. The 2nd price is set at 4.40 Euros for orders which choose the delivery method.
Tested using 2 local pickup methods and 1 flat rate shipping method for delivery. Will work with any type of shipping method, zone or region.
There’s 2 simple steps :
1. Copy and paste the PHP code to the end of your child themes functions.php file or custom functionality plugin.
2. Set the shipping zone I.D on line 24 and the price to match that shipping method on line 26.
Find Shipping Zone I.D’s
Ijn your WordPress Dashboard, go to WooCommerce > Settings > Shipping and inspect the shipping zone name to find the I.D.
These solutions may also help :