2016-11-15 21:53:11 +00:00
|
|
|
<?php
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Legacy Shipping Zone.
|
|
|
|
*
|
2017-03-15 16:36:53 +00:00
|
|
|
* @version 3.0.0
|
2020-08-05 16:36:24 +00:00
|
|
|
* @package WooCommerce\Classes
|
2016-11-15 21:53:11 +00:00
|
|
|
* @category Class
|
|
|
|
* @author WooThemes
|
|
|
|
*/
|
|
|
|
abstract class WC_Legacy_Shipping_Zone extends WC_Data {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get zone ID
|
|
|
|
* @return int|null Null if the zone does not exist. 0 is the default zone.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @deprecated 3.0
|
2016-11-15 21:53:11 +00:00
|
|
|
*/
|
|
|
|
public function get_zone_id() {
|
2017-03-15 16:36:53 +00:00
|
|
|
wc_deprecated_function( 'WC_Shipping_Zone::get_zone_id', '3.0', 'WC_Shipping_Zone::get_id' );
|
2016-11-15 21:53:11 +00:00
|
|
|
return $this->get_id();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Read a shipping zone by ID.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @deprecated 3.0.0 - Init a shipping zone with an ID.
|
2017-05-15 11:50:52 +00:00
|
|
|
*
|
|
|
|
* @param int $zone_id
|
2016-11-15 21:53:11 +00:00
|
|
|
*/
|
|
|
|
public function read( $zone_id ) {
|
2017-03-15 16:36:53 +00:00
|
|
|
wc_deprecated_function( 'WC_Shipping_Zone::read', '3.0', 'a shipping zone initialized with an ID.' );
|
2016-11-15 21:53:11 +00:00
|
|
|
$this->set_id( $zone_id );
|
|
|
|
$data_store = WC_Data_Store::load( 'shipping-zone' );
|
|
|
|
$data_store->read( $this );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update a zone.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @deprecated 3.0.0 - Use ::save instead.
|
2016-11-15 21:53:11 +00:00
|
|
|
*/
|
|
|
|
public function update() {
|
2017-03-23 15:32:02 +00:00
|
|
|
wc_deprecated_function( 'WC_Shipping_Zone::update', '3.0', 'WC_Shipping_Zone::save instead.' );
|
2016-11-15 21:53:11 +00:00
|
|
|
$data_store = WC_Data_Store::load( 'shipping-zone' );
|
|
|
|
try {
|
|
|
|
$data_store->update( $this );
|
|
|
|
} catch ( Exception $e ) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a zone.
|
2017-03-15 16:36:53 +00:00
|
|
|
* @deprecated 3.0.0 - Use ::save instead.
|
2016-11-15 21:53:11 +00:00
|
|
|
*/
|
|
|
|
public function create() {
|
2017-03-23 15:32:02 +00:00
|
|
|
wc_deprecated_function( 'WC_Shipping_Zone::create', '3.0', 'WC_Shipping_Zone::save instead.' );
|
2016-11-15 21:53:11 +00:00
|
|
|
$data_store = WC_Data_Store::load( 'shipping-zone' );
|
|
|
|
try {
|
|
|
|
$data_store->create( $this );
|
|
|
|
} catch ( Exception $e ) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|