Hide UPS Services for Shipments Weighing more than 10lbs and Show only FedEx
#1 WooCommerce FedEx Shipping plugin that offers unparalleled features like Automatic Shipping Label, Return Label generation, Shipment Tracking, and Multi-Vendor Support.
- 6,000+ Active Installs
- 100+ Customer Reviews
- 97% Customer Satisfaction Rating
By using the shipping plugins store owners can easily show various shipping services. The FedEx Shipping Plugin, for example, can allow the users to show the desired shipping services on the Cart/Checkout page. However, there are many business scenarios where the user wants to implement a certain condition. This condition can be based on the shipping zone, shipping class, item quantity, etc. The power to control the display of the shipping services is a highly requested feature.
In this article, we will show you how to hide certain shipping methods based on the total weight of the shipment. This way, store owners can set a weight limit beyond which the selected shipping services will be automatically hidden on the Cart or Checkout page. So, let us quickly get on with the article.
Initially, you need to refer the following code snippet and paste the code snippet in, Appearance–> Editor–> Theme functions(functions.php) and then click on Update File.
We are going to hide the UPS shipping service whenever the total weight of the shipment is more than 10 lbs. This way only FedEx services will be visible on the Cart page. Here, you would need to define the shipping methods that you need to hide. In the following line of code, you can see many shipping methods.
$shipping_services_to_hide = array(
These shipping service names are termed as value. They can be obtained by selecting the respective services on the cart page. Thereafter, you need to Inspect that service and you would obtain the service value. You can refer the following video for the same.
By following these steps, you can choose the choice of services and then paste it in the code snippet. After doing the above steps you have to set the weight limit. You can do that in the following line of code.
if($weight_oz > 10)
Here, you can choose to set the greater than or lesser than sign as well. Following are the valid signs – <, >, <= and >=. In the above case, we are going to define the weight limit of 10lbs. So, whenever the order weight crosses the threshold of this weight, only FedEx services will be visible. You can refer the following video that shows that working of this code snippet.
If you have any query regarding this article or the integration of WooCommerce FedEx Shipping plugin with your WooCommerce then feel free to share your views in the comment section below. We will be more than happy to help you understand how this plugin can work together in fulfilling your shipping requirements.
Or in case you are wondering what more does the WooCommerce FedEx Shipping plugin serve, I would request you to kindly visit the official product page here.
About the plugin…
WooCommerce FedEx Shipping Plugin with Print Label
- WooCommerce requires at least 2.6 up to 3.2.
- The license entitles 1 year of support & updates.
- No monthly fees or yearly subscription.
- Extend support & updates after 1 year at 50% discount.
- Protected by 30 Day Money Back Guarantee.