2016-11-15 21:53:11 +00:00
|
|
|
<?php
|
2018-03-06 09:59:23 +00:00
|
|
|
/**
|
|
|
|
* Shipping Zone Data Store Interface
|
|
|
|
*
|
|
|
|
* @version 3.0.0
|
2020-08-05 16:36:24 +00:00
|
|
|
* @package WooCommerce\Interface
|
2018-03-06 09:59:23 +00:00
|
|
|
*/
|
|
|
|
|
2016-11-15 21:53:11 +00:00
|
|
|
/**
|
2016-11-16 11:18:47 +00:00
|
|
|
* WC Shipping Zone Data Store Interface.
|
2016-11-15 21:53:11 +00:00
|
|
|
*
|
|
|
|
* Functions that must be defined by shipping zone store classes.
|
|
|
|
*
|
2017-03-15 16:36:53 +00:00
|
|
|
* @version 3.0.0
|
2016-11-15 21:53:11 +00:00
|
|
|
*/
|
|
|
|
interface WC_Shipping_Zone_Data_Store_Interface {
|
2016-11-15 22:55:14 +00:00
|
|
|
/**
|
2016-11-16 11:18:47 +00:00
|
|
|
* Get a list of shipping methods for a specific zone.
|
2018-03-06 09:59:23 +00:00
|
|
|
*
|
|
|
|
* @param int $zone_id Zone ID.
|
|
|
|
* @param bool $enabled_only True to request enabled methods only.
|
|
|
|
* @return array Array of objects containing method_id, method_order, instance_id, is_enabled
|
2016-11-15 22:55:14 +00:00
|
|
|
*/
|
|
|
|
public function get_methods( $zone_id, $enabled_only );
|
2016-11-15 21:53:11 +00:00
|
|
|
|
2016-11-15 22:55:14 +00:00
|
|
|
/**
|
|
|
|
* Get count of methods for a zone.
|
2018-03-06 09:59:23 +00:00
|
|
|
*
|
|
|
|
* @param int $zone_id Zone ID.
|
2016-11-15 22:55:14 +00:00
|
|
|
* @return int Method Count
|
|
|
|
*/
|
|
|
|
public function get_method_count( $zone_id );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a shipping method to a zone.
|
2018-03-06 09:59:23 +00:00
|
|
|
*
|
|
|
|
* @param int $zone_id Zone ID.
|
|
|
|
* @param string $type Method Type/ID.
|
|
|
|
* @param int $order Method Order ID.
|
|
|
|
* @return int Instance ID
|
2016-11-15 22:55:14 +00:00
|
|
|
*/
|
|
|
|
public function add_method( $zone_id, $type, $order );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete a method instance.
|
2018-03-06 09:59:23 +00:00
|
|
|
*
|
|
|
|
* @param int $instance_id Intance ID.
|
2016-11-15 22:55:14 +00:00
|
|
|
*/
|
|
|
|
public function delete_method( $instance_id );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a shipping zone method instance.
|
2018-03-06 09:59:23 +00:00
|
|
|
*
|
|
|
|
* @param int $instance_id Instance ID.
|
2016-11-15 22:55:14 +00:00
|
|
|
* @return object
|
|
|
|
*/
|
|
|
|
public function get_method( $instance_id );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Find a matching zone ID for a given package.
|
2018-03-06 09:59:23 +00:00
|
|
|
*
|
|
|
|
* @param object $package Zone package object.
|
2016-11-15 22:55:14 +00:00
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function get_zone_id_from_package( $package );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return an ordered list of zones.
|
2018-03-06 09:59:23 +00:00
|
|
|
*
|
2016-11-15 22:55:14 +00:00
|
|
|
* @return array An array of objects containing a zone_id, zone_name, and zone_order.
|
|
|
|
*/
|
|
|
|
public function get_zones();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a zone ID from an instance ID.
|
2018-03-06 09:59:23 +00:00
|
|
|
*
|
|
|
|
* @param int $id Instance ID.
|
2016-11-15 22:55:14 +00:00
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function get_zone_id_by_instance_id( $id );
|
2016-11-15 21:53:11 +00:00
|
|
|
}
|