Different Price Based on WooCommerce Shipping Method

$50.00

This PHP code changes the cart price per unit based on the chosen shipping method using multiple shipping methods with a single shipping zone. When a shipping method is chosen, the price per unit changes and the cart totals are updated dynamically.

The shipping methods in this example are setup like this :

single-shipping-one-multiple-methods

You can use the code with any amount of shipping methods linked to any amount of custom prices.

Note : You can use this code with multiple shipping methods, multiple prices and any shipping plugin.

Code Installation

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. Swap out the shipping method ids on lines 17, 18 and 20 and the price on line 31.

Find Shipping Method ID’s

You can inspect each shipping method to find the id for each.

How To Find Shipping Method ID's

These solutions may also help :