PHP Class WC_Shipping_Zone_Data_Store

Author: WooCommerce
Inheritance: extends WC_Data_Store_WP, implements WC_Shipping_Zone_Data_Store_Interface, implements WC_Object_Data_Store_Interface
Show file Open project: woocommerce/woocommerce

Public Methods

Method Description
add_method ( integer $zone_id, string $type, integer $order ) : integer Add a shipping method to a zone.
create ( &$zone ) Method to create a new shipping zone.
delete ( &$zone, array $args = [] ) : boolean Deletes a shipping zone from the database.
delete_method ( integer $instance_id ) Delete a method instance.
get_method ( $instance_id ) : object Get a shipping zone method instance.
get_method_count ( $zone_id ) : integer Get count of methods for a zone.
get_methods ( integer $zone_id, boolean $enabled_only ) : array Get a list of shipping methods for a specific zone.
get_zone_id_by_instance_id ( $id ) : integer Return a zone ID from an instance ID.
get_zone_id_from_package ( object $package ) : integer Find a matching zone ID for a given package.
get_zones ( ) : array Return an ordered list of zones.
read ( &$zone ) Method to read a shipping zone from the database.
update ( &$zone ) Update zone in the database.

Private Methods

Method Description
read_zone_locations ( &$zone ) Read location data from the database.
save_locations ( &$zone ) Save locations to the DB.

Method Details

add_method() public method

Add a shipping method to a zone.
Since: 2.7.0
public add_method ( integer $zone_id, string $type, integer $order ) : integer
$zone_id integer Zone ID
$type string Method Type/ID
$order integer Method Order
return integer Instance ID

create() public method

Method to create a new shipping zone.
Since: 2.7.0
public create ( &$zone )

delete() public method

Deletes a shipping zone from the database.
Since: 2.7.0
public delete ( &$zone, array $args = [] ) : boolean
$args array Array of args to pass to the delete method.
return boolean result

delete_method() public method

Delete a method instance.
Since: 2.7.0
public delete_method ( integer $instance_id )
$instance_id integer

get_method() public method

Get a shipping zone method instance.
Since: 2.7.0
public get_method ( $instance_id ) : object
return object

get_method_count() public method

Get count of methods for a zone.
Since: 2.7.0
public get_method_count ( $zone_id ) : integer
return integer Method Count

get_methods() public method

Get a list of shipping methods for a specific zone.
Since: 2.7.0
public get_methods ( integer $zone_id, boolean $enabled_only ) : array
$zone_id integer Zone ID
$enabled_only boolean True to request enabled methods only.
return array Array of objects containing method_id, method_order, instance_id, is_enabled

get_zone_id_by_instance_id() public method

Return a zone ID from an instance ID.
Since: 2.7.0
public get_zone_id_by_instance_id ( $id ) : integer
return integer

get_zone_id_from_package() public method

Find a matching zone ID for a given package.
Since: 2.7.0
public get_zone_id_from_package ( object $package ) : integer
$package object
return integer

get_zones() public method

Return an ordered list of zones.
Since: 2.7.0
public get_zones ( ) : array
return array An array of objects containing a zone_id, zone_name, and zone_order.

read() public method

Method to read a shipping zone from the database.
Since: 2.7.0
public read ( &$zone )

update() public method

Update zone in the database.
Since: 2.7.0
public update ( &$zone )