Code snippet: price adjustment for the specific value of cart order

This  code snippet will help you to offer a price adjustment for the certain value of the order. Let's say that you want to offer a price adjustment of 50% for ups ground service when the cart order is above than $40. Steps to add code snippet: 1.Add the following code to your functions.php or anywhere relevant. 2. Then you need to set the variable  $minimum_cart_price_to_adjust to 40. 3. After that, you need to give the value of the service in the array for [...]

Hide Shipping methods when Shipping classes (exist) / (do not exist) in cart.

The below code snippet can be used to hide shipping methods based on whether shipping classes are present in cart or not. Add the following code to your functions.php or anywhere relevant. If you are looking for a plugin to do this job, visit ELEX Hide Shipping Methods Plugin. Using this plugin, You can easily hide shipping methods based on various conditions. - If shipping ID "42" is present in cart, then the snippet will hide "Free Shipping". - If shipping ID [...]

Select a particular package type for a shipping method based on order total weight

This code snippet will help you to select a particular package type for a shipping method based on order total weight. The above is a ready to use snippet which only requires changes in these three lines: 1. $weight_less_than[] = array('weight'=>1, 'service_code'=>'US-XM', 'package_type'=>'USPS Legal Flat Rate Envelope'); //Enter proper values or remove this line 2. $weight_greater_than[] = array('weight'=>1, 'service_code'=>'US-XM', 'package_type'=>'Package'); //Enter proper values or remove this line 3. $weight_equal_to[] = array('weight'=>1, 'service_code'=>'US-XM', 'package_type'=>'USPS Legal Flat Rate Envelope'); //Enter proper values or remove this [...]

Ignore the flat rates returned by Stamps which are less in size than the package requested

The following code snippet will ignore the rates returned by Stamps which are less in size than the package requested in API. Kindly copy this snippet into Appearance --> Editor --> functions.php of your Wordpress theme For instance if you have selected a box of dimensions 9x9x9 for packing your items. Now, Stamps will return all flat rates irrespective of the size requested. That means, it will return flat rates for box sizes greater than 9x9x9 as well rates for box [...]

Code snippet to ignore the digits after ‘-‘ in postcodes provided for ‘Ship to’ address in Stamps plugin

The code snippet facilitates to ignore the numbers after '-' in postcodes provided for 'Ship to' address. Add the following code to your Appearance --> Editor --> functions.php. Suppose customer provides the following postcode to place an order '90746-4028'. The above code snippet will ignore the postcodes after '-', so 4028 will be ignored and only '90746' will be considered. Using the first 5 digits for postcode works perfectly with Stamps API.

Code snippet(based on States) to adjust the base cost of one of the shipping classes if both of them come up in the cart .

The following code snippet(based on States) can be used to adjust the base cost of one of the shipping classes if both of them come up in the cart. Note : This snippet only functions with our Shipping Pro plugin. Kindly copy this snippet into Appearance --> Editor --> functions.php of your Wordpress theme In the above snippet, the following three changes need to be made. 1. Include state codes for which you want the subtraction of base cost to happen. In the above snippet, [...]

How to convert Base currency to DHL currency, dynamically?

The following code snippet facilitates you to convert base currency to DHL currency, by fetching live conversion rates from Alpha Vantage. Note: This snippet would only work with WooCommerce DHL Express plugin with Print Label. Add the following code to your functions.php, or anywhere relevant. For this code snippet to work, you need to do two small changes: Update the php.ini file with following values - allow_url_fopen = ON allow_url_include = ON Restart your Apache server once the above changes are made. Once you include the [...]

Code Snippet to rearrange shipping methods in cart page

The code snippet facilitates you to rearrange shipping methods in cart page. Add the following code to your functions.php or anywhere relevant. You can see in the code snippet, the arrangement of shipping methods are in the order: 1. UPS 2. USPS 3. Free Shipping 4. Local Pickup 5. Flat Rate So the cart page should display prices in the above order. This can be verified from the screenshot below :   .button { border-radius: 5px; background-color: #5472D2; border: none; color: #FFFFFF; text-align: center; [...]

Code Snippet to adjust price for a service based on state!

The code snippet facilitates you to adjust the price for a service based on the state! Note: This snippet should work with WooCommerce UPS Shipping plugin only. Also, before using this snippet, kindly ensure that you have version "2.7.6" or higher. Add the following code to your functions.php or anywhere relevant. In the above snippet, you can add the states for which you want to adjust the price. Here for convenience, we have added "CA" California State. Also, you can provide the adjustment percentage [...]

Snippet to configure a minimum shipping amount for UPS

The below code snippet is used to configure minimum shipping amount for UPS services. In the above snippet, the user has to set the minimum value in this variable : $min_shipping_rate = 10; Here, a minimum value of 10 is set. So, for any service, if UPS API returns any value less than 10, then the snippet overrides this and shows a value of 10 in the cart as shown in screenshot below : Before incorporating snippet: After incorporating snippet :