abstract-wc-legacy-order.php
1 year ago
abstract-wc-legacy-payment-token.php
5 years ago
abstract-wc-legacy-product.php
1 year ago
class-wc-legacy-cart.php
3 years ago
class-wc-legacy-coupon.php
5 years ago
class-wc-legacy-customer.php
5 years ago
class-wc-legacy-shipping-zone.php
5 years ago
class-wc-legacy-webhook.php
5 years ago
class-wc-legacy-shipping-zone.php
69 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | exit; |
| 4 | } |
| 5 | |
| 6 | /** |
| 7 | * Legacy Shipping Zone. |
| 8 | * |
| 9 | * @version 3.0.0 |
| 10 | * @package WooCommerce\Classes |
| 11 | * @category Class |
| 12 | * @author WooThemes |
| 13 | */ |
| 14 | abstract class WC_Legacy_Shipping_Zone extends WC_Data { |
| 15 | |
| 16 | /** |
| 17 | * Get zone ID |
| 18 | * @return int|null Null if the zone does not exist. 0 is the default zone. |
| 19 | * @deprecated 3.0 |
| 20 | */ |
| 21 | public function get_zone_id() { |
| 22 | wc_deprecated_function( 'WC_Shipping_Zone::get_zone_id', '3.0', 'WC_Shipping_Zone::get_id' ); |
| 23 | return $this->get_id(); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Read a shipping zone by ID. |
| 28 | * @deprecated 3.0.0 - Init a shipping zone with an ID. |
| 29 | * |
| 30 | * @param int $zone_id |
| 31 | */ |
| 32 | public function read( $zone_id ) { |
| 33 | wc_deprecated_function( 'WC_Shipping_Zone::read', '3.0', 'a shipping zone initialized with an ID.' ); |
| 34 | $this->set_id( $zone_id ); |
| 35 | $data_store = WC_Data_Store::load( 'shipping-zone' ); |
| 36 | $data_store->read( $this ); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Update a zone. |
| 41 | * @deprecated 3.0.0 - Use ::save instead. |
| 42 | */ |
| 43 | public function update() { |
| 44 | wc_deprecated_function( 'WC_Shipping_Zone::update', '3.0', 'WC_Shipping_Zone::save instead.' ); |
| 45 | $data_store = WC_Data_Store::load( 'shipping-zone' ); |
| 46 | try { |
| 47 | $data_store->update( $this ); |
| 48 | } catch ( Exception $e ) { |
| 49 | return false; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Create a zone. |
| 55 | * @deprecated 3.0.0 - Use ::save instead. |
| 56 | */ |
| 57 | public function create() { |
| 58 | wc_deprecated_function( 'WC_Shipping_Zone::create', '3.0', 'WC_Shipping_Zone::save instead.' ); |
| 59 | $data_store = WC_Data_Store::load( 'shipping-zone' ); |
| 60 | try { |
| 61 | $data_store->create( $this ); |
| 62 | } catch ( Exception $e ) { |
| 63 | return false; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | |
| 68 | } |
| 69 |