What can we help you with?

Code Snippet for Displaying FedEx One Rate Shipping Services on the Cart and Checkout Pages

In this article, we will demonstrate how to display selected FedEx One Rate shipping rates on your WooCommerce store during checkout using the ELEX EasyPost (FedEx, UPS, Canada Post & USPS) Shipping & Label Printing Plugin for WooCommerce.


In the code snippet below, we have only activated “FedEx 2 day and Priority overnight” services in order to display them on the cart page.

add_filter('woocommerce_package_rates', 'elex_hide_fedex_one_rate_service', 10, 2); 
function elex_hide_fedex_one_rate_service($available_shipping_methods, $package){
foreach ($available_shipping_methods as $shipping_method => $value) {
if(isset($shipping_method) && is_int(stripos($shipping_method ,'wf_easypost_id:FedEx:'))){
$id = $value->id;
$fedex_one_rate_service = explode(':',$id);
$services_to_show = array('FEDEX_2_DAY','PRIORITY_OVERNIGHT');
if(empty(array_intersect($fedex_one_rate_service,$services_to_show)) ){


return $available_shipping_methods;

You can simply add the above code to the activated theme’s functions.php file on your site and save the changes for implementing the code. Check the below screenshot to understand this better: FedEx One Rate

You also need to enable the FedEx One Rate shipping services in the rate and services settings of the plugin. 

FedEx One Rate

Cart page before implementing the code snippet: 

FedEx One Rate

Cart page after implementing the code snippet: 

More information about the plugin’s features is available on the product page.

For any queries, please contact our support team.

Next How to Enable the First Class Mail Shipping Services Option?
You must be logged in to post a comment.