5.1.5 Shipping - Core Shipping Options - Legacy Shipping Options

Created by Danny Wong, Modified on Fri, 07 Aug 2020 at 12:22 PM by Danny Wong

Legacy Shipping Options

In WooCommerce 2.6 we introduced Shipping Zones that replace shipping options previously in core.

If you’re using any of the previous (called ‘legacy’) shipping methods, they will continue to function. But we recommend moving to Shipping Zones as soon as possible because legacy methods will be removed in future releases.

Shipping Zones allows options to be used multiple times, so some former methods (such as international flat rate) are no longer required and can be replaced with Flat Rate Shipping.

Flat Rate Shipping

Flat Rate Shipping is a shipping method included free in WooCommerce that allows you define a standard rate per item, per shipping class or per order.

Settings are found at: WooCommerce > Settings > Shipping > Flat Rates.

Flat Rate Settings

Flat Rate Shipping works with Product Shipping Classes, adding more power and flexibility.

Configuration

In the Settings screen, there are a few options to choose from:

  • Enable/Disable – Tick the box to enable Flat Rates.
  • Method Title – Name the method. This is what the customer sees when selecting a shipping method.
  • Availability – Define ‘All allowed countries’ or ‘specific countries’ to limit where Flat Rates are offered.
  • Tax Status – Define whether or not tax is applied to the shipping amount.
  • Cost – Define a cost applied to the entire cart. You can add additional costs per item to this field. This is covered below.

Advanced Costs

The Cost field allows you to charge a flat rate per item, a percentage based cost, or a minimum fee.

Available placeholders:

  • [qty] – Number of products in the cart
  • [fee] – An additional fee. This fee has two optional arguments.
    • percent – A percentage based on total order cost.
    • min_fee – A minimum amount. Useful when using percentages.

Examples

  • 10 + ( 2 * [qty] ) – A base shipping cost of $10 plus $2 for each item in the cart.
  • 20 + [fee percent="10" min_fee="4"] – A base shipping cost of $20 plus 10% of the order total, which is at least $4.

Shipping Classes

If you have shipping classes, the interface adds a few more fields:Flat Rate Shipping Settings Shipping Classes

There is one cost field for each shipping class.

  • No Shipping Class Cost – Useful if you use the Per Class option below. Otherwise, use the Cost field.
  • Calculation Type – Two options:
    • Per Order – Picks the most expensive option based on shipping costs in the cart.
    • Per Class – Charges shipping for each shipping class.

International Flat Rate Shipping

International Flat Rate is based on Flat Rate Shipping, which allows you define a standard rate per order, per item or per shipping class for international delivery.

The settings page is found at: WooCommerce > Settings> Shipping > International Flat Rate.

International Shipping Settings

International Flat Rates works with Product Shipping Classes, adding more power and flexibility.

Configuration

  • Enable/Disable – Tick the box to enable International Flat Rates.
  • Method Title – Name the method. This is what the customer sees when selecting a shipping method.
  • Availability – Define ‘All allowed countries’ or ‘specific countries’ to limit where International Flat Rates are offered.
  • Tax Status – Define whether or not tax is applied to the shipping amount.
  • Cost – Define a cost applied to the entire cart. You can add additional costs per item to this field. This is covered below.

Advanced Costs

What if you want to charge an international flat rate per item? Or a percentage-based cost? Or enforce a minimum fee? This is why we allow math in the Cost field.

Available placeholders:

  • [qty] – Number of products in the cart
  • [fee]– An additional fee. This fee has two optional arguments.
    • percent – A percentage based on total order cost.
    • min_fee – A minimum amount. Useful when using percentages.

Examples

  • 10 + ( 2 * [qty] ) – A base shipping cost of $10 plus $2 for each item in the cart.
  • 20 + [fee percent="10" min_fee="4"] – A base shipping cost of $20 plus 10% of the order total, which is at least $4.

Shipping Classes

If you have shipping classes, there is another section that adds a few more fields you can use:

  • There will be a cost field for each shipping class you have.
  • No Shipping Class Cost – Useful if you use the Per Class option below. Otherwise, use the Cost field.
  • Calculation Type– Two options:
    • Per Order – Picks the most expensive option based on shipping costs in the cart.
    • Per Class – Charges shipping for each shipping class.

Free Shipping

If you enable free shipping, customers will have access to free shipping on their orders. This is a great shipping method to use to encourage customers to spend more. For example, give them free shipping on orders over $100.

Setup and Configuration

Be sure you give it a Method Title and set a Method Availability.

In Method Availability you can choose All allowed countries, letting any customer from any country be eligible for free shipping, or Specific Countries. If you choose Specific Countries a new field titled Specific Countries will appear you can use to limit free shipping to.

You can then specify a conditions they must meet to be granted free shipping in the Free Shipping Requires… Those are:

  • N/A – Not available, Free Shipping is an option for all customers
  • A valid free shipping coupon – A coupon created that enables free shipping
  • A minimum order amount (defined below) – Set the amount in the Minimum Order Amount field.
  • A minimum order amount OR a coupon
  • A minimum order amount AND a coupon

Create Free Shipping Coupons

Step 1: Create a coupon
First create a coupon and then tick the Free Shipping box. More info at: (Coupon Management).

Step 2: Enable free shipping for coupons
In ‘free shipping’ settings, tick the option to require a free shipping coupon. Thats it! Customers can now use the coupon to get free shipping during checkout.

Coupon vs. Min Amount Handling

If you have coupons for free shipping and min-amount, coupons take priority. If the user has a coupon, the min-amount is ignored. If, however, the user doesn’t have a coupon, min-amount will be checked.

(Advanced) Enabling or disabling Free shipping via hooks

The free shipping method has an is_available function that can be hooked into:

return apply_filters( 'woocommerce_shipping_' . $this->id . '_is_available', $is_available );

This means you can use add_filter() on woocommerce_shipping_free_shipping_is_available and return true or false.

Local Delivery (removed)

Local Delivery has been removed from Legacy Shipping. See Shipping Zones.

Local delivery is a shipping method for delivering orders locally. The fee can be specified based on a percentage of the cart total or a flat fee, or it can be free.

WooCommerce Local Delivery

You can enable and configure Local Delivery at: WooCommerce > Settings > Shipping > Local Delivery

Taxes for Local Delivery are based on the store location settings. If your tax rules are based on postcodes/zipcodes, then you need to use a function to ensure the store postcode/zipcode is included.


/**

 * Set the store base city and postcode / zipcode

 */

add_filter( 'woocommerce_countries_base_city' , 'set_woocommerce_countries_base_city' );

function set_woocommerce_countries_base_city() {

    // Replace with your store town/city

    return 'Townland';

}



add_filter( 'woocommerce_countries_base_postcode' , 'set_woocommerce_countries_base_postcode' );

function set_woocommerce_countries_base_postcode() {

    // Replace with your store postcode / zipcode

    return '45040';

}
view rawgistfile1.php hosted with ❤ by GitHub

Local Pickup (removed)

Local Pickup has been removed from Legacy Shipping. See Local Pickup for WooCommerce.

Local Pickup is a method that allows the customer to pick up the order themselves.

You can enable and configure Local Pickup from WP DashboardWooCommerceSettingsShipping > Local Pickup.

Local Pickup

Note: The Local Pickup shipping method calculates taxes based on your base store location and not the customer’s address.

To disable tax calculation for Local Pickup, add the following code at the end of your functions.php file:

add_filter( 'woocommerce_apply_base_tax_for_local_pickup', '__return_false' );

To charge local taxes based on postcode and city for Local Pickup, you need to define the shop’s base city and postcode using this snippet:


add_filter( 'woocommerce_countries_base_postcode', create_function( '', 'return "80903";' ) );

add_filter( 'woocommerce_countries_base_city', create_function( '', 'return "COLORADO SPRINGS";' ) );
view raw functions.php hosted with ❤ by GitHub

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article