- Add the following code to your functions.php or any where relevant.
- You need to Products > Shipping Class in Admin Panel.
- You also need to get the code for the service.
Code Snippet 02 – Hide the undesired service for the required states
- Add the following code to your functions.php or any where relevant.
- Find the SERVICE_CODE from the FedEx shipping settings page and prepare the shipping service “wf_fedex_woocommerce_shipping:SERVICE_CODE”.
- Modify the shipping service and the list of states in the following code as per your requirement.
For example: To disable FedEx ground shipping service for the couple of states in USA. $exclude = array( ‘wf_fedex_woocommerce_shipping:FEDEX_GROUND’ => array(‘AK’,’AZ’,’CA’,’CO’));
The Code is as given below:
Code Snippet 03 – Hide the undesired service for the required Zip Codes(FedEx)
Steps to add Code Snippet
- Add the following code to your functions.php or any where relevant.
- You need to get the code for the service.
- Unset the rates for required service code.
For example: To disable FedEx ground shipping service for the zip code 93999, the code is unset( $rates [‘wf_fedex_woocommerce_shipping:FEDEX_GROUND’] );
The Code is as given below:
Code Snippet 05 – Hide the undesired method for the particular existing shipping class(Australia Post)
Steps to add Code Snippet
- Add the following code to your functions.php or any where relevant.
- You need to get the code for the service.
- Australia Post methods will not be shown in the cart/checkout page, if the product belongs to the $shipping_class_ids array.
The Code is as given below:
Code Snippet 06 – Hide the undesired First Class Mail services on WooForce USPS Plugin.
Add the following code to your functions.php or any where relevant.The Code is as given below:
Code Snippet 07 – Hide/show USPS services based on the quantity of items in the cart
- Showing only First Class Mail service if the cart contains upto 2 items.
- Showing only Standard Post (previously known as USPS Retail Ground) service if the cart contains more than 2 to 30 items.
- Not showing any USPS service if the cart contains more than 30 items.
Add the following code to your functions.php or any where relevant.The Code is as given below:
In the above code, $available_shipping_methods array stores all the information about the shipment package. If $unit is less than 3, then only D_FIRST_CLASS shipping service is returned. If $unit is more than 2 and less than 31, then only D_STANDARD_POST shipping service is returned. If $unit is more than 30,then $available_shipping_methods is unset so that no USPS service will be displayed.