Class WC_Shipping

Package: WooCommerce\Classes\Shipping
Author: WooThemes
Located at includes/class-wc-shipping.php

Methods summary

public static Main
# instance( )

Main WooCommerce Instance

Main WooCommerce Instance

Ensures only one instance of WooCommerce is loaded or can be loaded.

Returns

Main
WooCommerce instance

Since

2.1

See

WC()
public
# __clone( )

Cloning is forbidden.

Cloning is forbidden.

Since

2.1
public
# __wakeup( )

Unserializing instances of this class is forbidden.

Unserializing instances of this class is forbidden.

Since

2.1
public
# __construct( )

__construct function.

__construct function.

public
# init( )

init function.

init function.

public array
# load_shipping_methods( array $package = array() )

load_shipping_methods function.

load_shipping_methods function.

Loads all shipping methods which are hooked in. If a $package is passed some methods may add themselves conditionally.

Methods are sorted into their user-defined order after being loaded.

Parameters

$package
array
$package

Returns

array
public
# register_shipping_method( object|string $method )

Register a shipping method for use in calculations.

Register a shipping method for use in calculations.

Parameters

$method
object|string
$method Either the name of the method's class, or an instance of the method's class
public
# unregister_shipping_methods( )

unregister_shipping_methods function.

unregister_shipping_methods function.

public array
# sort_shipping_methods( )

sort_shipping_methods function.

sort_shipping_methods function.

Sorts shipping methods into the user defined order.

Returns

array
public array
# get_shipping_methods( )

get_shipping_methods function.

get_shipping_methods function.

Returns all registered shipping methods for usage.

Returns

array
public array
# get_shipping_classes( )

get_shipping_classes function.

get_shipping_classes function.

Load shipping classes taxonomy terms.

Returns

array
public
# calculate_shipping( array $packages = array() )

calculate_shipping function.

calculate_shipping function.

Calculate shipping for (multiple) packages of cart items.

Parameters

$packages
array
$packages multi-dimensional array of cart items to calc shipping for
public array
# calculate_shipping_for_package( array $package = array() )

calculate_shipping_for_package function.

calculate_shipping_for_package function.

Calculates each shipping methods cost. Rates are cached based on the package to speed up calculations.

Parameters

$package
array
$package cart items

Returns

array
public array
# get_packages( )

Get packages

Get packages

Returns

array
public
# reset_shipping( )

reset_shipping function.

reset_shipping function.

Reset the totals for shipping as a whole.

public
# process_admin_options( )

process_admin_options function.

process_admin_options function.

Saves options on the shipping setting page.

Magic methods summary

Properties summary

public boolean $enabled
#

True if shipping is enabled.

True if shipping is enabled.

public array $shipping_methods
#

Stores methods loaded into woocommerce.

Stores methods loaded into woocommerce.

public float $shipping_total
#

Stores the cost of shipping

Stores the cost of shipping

public array $shipping_taxes
#

Stores an array of shipping taxes.

Stores an array of shipping taxes.

public array $shipping_classes
#

Stores the shipping classes.

Stores the shipping classes.

public array $packages
#

Stores packages to ship and to get quotes for.

Stores packages to ship and to get quotes for.

protected static WooCommerce $_instance
#

The single instance of the class

The single instance of the class

Since

2.1
WooCommerce API documentation generated by ApiGen 2.8.0