WooCommerce Shipping – FedEx Live Rate Adjustment based on Shipping Classes

This article will cover an interesting shipping scenario involving WooCommerce Flat Rate Shipping along with the live FedEx Shipping adjustment Rates with the help of WooCommerce FedEx Shipping plugin.

Business Case

Charles owns a WooCommerce store and has an interesting shipping scenario. According to Charles,

I have 2 products in the cart. One with a flat rate shipping of $8 and the other which I generally ship via FedEx. The shipping cost is generally $30 for Standard Overnight delivery. What I want to display to the customer is a combined value of both the rates $8 and $30 in the cart/checkout page. So, $38 for Standard overnight must display instead of $30. Is this possible..?

Solution

This scenario can be easily achieved using the following,

Pre-Requisites

In order to set up this scenario, you would require the following

Create Shipping Classes

Based on the requirements, create two shipping classes and assign products to both of them

  • Flat Rate Shipping Class
    This shipping class will include all the products which you want to ship and charge a flat rate shipping fee
  • Standard Shipping Class
    This shipping class will include all the products which you want to ship via FedEx

Shipping Class Slug

Every WooCommerce Shipping Class has a unique slug which you can find by visiting,

WooCommerce => Settings => Shipping => Shipping Class.

Copy the Shipping Class Slug for the Flat Rate Shipping Class.

Shipping Method Value on the Cart Page

You need to get the Shipping Method Value for all the shipping methods for which you want to add the Flat Rate Charge to the shipping cost. To find the value for a shipping method on the cart page,

  • Right Click on the shipping method on the cart page and click on Inspect
  • Copy the Value as shown in the image below
    FedEx Live Rate Adjustment

How to Set Up?

In order to set up this scenario, you need to follow the steps below.

  • Install and activate the WooCommerce FedEx Shipping Plugin on your WooCommerce store
  • Set up the plugin based on your requirements and enable the FedEx Shipping Services which you want to offer on your website
  • Install the Skip Shipping Class from Shipping Calculation Add-on plugin
  • Click on Settings and visit the plugin settings
    FedEx Live Rate Adjustment
  • Enable the Skip Shipping Class option.
  • Select the Flat Rate Shipping Class under the Shipping Class option. This will skip all the products in that shipping class from the FedEx shipping rates calculation
    FedEx Live Rate Adjustment
  • Click on Save Changes
  • Download and Install Hide WooCommerce Shipping Method based on Shipping Class and Zone Add-on plugin
  • Set up add-on plugin
    • In this case, since products in the FedEx Shipping Class does not require Flat Rate Shipping
    • Choose the FedEx Shipping Class under Shipping class section
    • Enter the value of Flat Rate shipping method under the Shipping Method option. This will hide the Flat Rate Shipping Method whenever the products having FedEx Shipping Class are there in the cart
      FedEx Live Rate Adjustment
  • Add the custom code to the Functions.php file by visiting, Appearance => Editor => Functions.php
    • Enter the shipping method values of all FedEx Shipping Services
    • Add the Flat Rate cost 8 in the code
    • Enter the Flat Rate Shipping Class Slug in the section shown below
    • Save the code
      FedEx Live Rate Adjustment

Shipping Scenario

  • Case1: When FedEx Products are in the cart
    FedEx Live Rate Adjustment
  • Case2: When Flat Rate Product is in the cart
    FedEx Live Rate Adjustment
  • Case3: Both FedEx and Flat Rate Products are in the cart
    FedEx Live Rate Adjustment
    Thus, when you have both FedEx and Flat Rate product in the cart, the flat rate of $8 will get added to the FedEx Ground.
    Hence, the final cost is $23.74 + $8 = $31.74 as shown in the screenshot above.

Final Thoughts

This article covers multiple shipping solutions developed to make life easier and handle complex shipping scenarios for the WooCommerce store owners. Feel free to use the solutions provided in this article and let our shipping experts know if you face any issues.

You can read more about our WooCommerce FedEx Shipping plugin. This plugin comes with a bunch of amazing features like real-time shipping rates, shipping label, shipment tracking, FedEx pickup, and much more.

Happy selling!

Last Updated On April 25, 2019