User Role Specific Free Shipping When Above Cart Total in WooCommerce

$25.00
Quick Demo

When a user with a specific user role logs in and their cart total is greater than a set limit, free shipping is displayed and they only need to enter their shipping address to complete checkout. All other user roles including logged out users need to calculate the shipping cost before checkout.

The code adds a custom user role named business customer and enables you to set the cart total limit which in this case is 50.

Free Shipping Based on User Role and Cart Total
Free Shipping Based on User Role and Cart Total

No other shipping options are displayed regardless of user role, logged in/out status or cart limit. Customers can only enter their shipping address with the calculation made only when the total is below the set limit for any user role.

Installation

  1. Copy & paste the PHP code to the end of your child themes functions.php file or custom functionality plugin.
  2. Set your user role name and slug on line 11

  3. Set your user role slug on line 21

  4. Set your cart total on line 27.

Display Free Shipping & Local Pickup

Use the PHP code in functions 2.php instead of functions.php and follow the same installation steps.

Free Shipping & Local Pickup Based on User Role and Cart Total
Free Shipping & Local Pickup Based on User Role & Cart Total

This PHP code applies the free shipping and local pickup automatically if order is above X amount and the custom user role is set.

  1. Set the user role name and slug on line 11.
  2. Set the user role slug on line 21.
  3. Set the amount for the cart total on line 27.

These solutions may also help :