2019-05-10 16:56:07 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* REST API Shipping Zone Methods controller
|
|
|
|
*
|
|
|
|
* Handles requests to the /shipping/zones/<id>/methods endpoint.
|
|
|
|
*
|
2020-09-17 14:56:08 +00:00
|
|
|
* @package WooCommerce\RestApi
|
2019-05-10 16:56:07 +00:00
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* REST API Shipping Zone Methods class.
|
|
|
|
*
|
2020-09-17 14:56:08 +00:00
|
|
|
* @package WooCommerce\RestApi
|
2019-05-10 16:56:07 +00:00
|
|
|
* @extends WC_REST_Shipping_Zone_Methods_V2_Controller
|
|
|
|
*/
|
|
|
|
class WC_REST_Shipping_Zone_Methods_Controller extends WC_REST_Shipping_Zone_Methods_V2_Controller {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Endpoint namespace.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $namespace = 'wc/v3';
|
2021-02-25 10:01:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the settings schema, conforming to JSON Schema.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function get_item_schema() {
|
2021-02-26 05:45:20 +00:00
|
|
|
// Get parent schema to append additional supported settings types for shipping zone method.
|
2021-02-25 10:01:49 +00:00
|
|
|
$schema = parent::get_item_schema();
|
|
|
|
|
2021-02-26 05:45:20 +00:00
|
|
|
// Append additional settings supported types (class, order).
|
2021-02-25 10:01:49 +00:00
|
|
|
$schema['properties']['settings']['properties']['type']['enum'][] = 'class';
|
|
|
|
$schema['properties']['settings']['properties']['type']['enum'][] = 'order';
|
|
|
|
|
|
|
|
return $this->add_additional_fields_schema( $schema );
|
|
|
|
}
|
2019-05-10 16:56:07 +00:00
|
|
|
}
|