Нет описания

class-wc-rest-shipping-zone-methods-controller.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * REST API Shipping Zone Methods controller
  4. *
  5. * Handles requests to the /shipping/zones/<id>/methods endpoint.
  6. *
  7. * @package WooCommerce\RestApi
  8. * @since 3.0.0
  9. */
  10. defined( 'ABSPATH' ) || exit;
  11. /**
  12. * REST API Shipping Zone Methods class.
  13. *
  14. * @package WooCommerce\RestApi
  15. * @extends WC_REST_Shipping_Zone_Methods_V2_Controller
  16. */
  17. class WC_REST_Shipping_Zone_Methods_Controller extends WC_REST_Shipping_Zone_Methods_V2_Controller {
  18. /**
  19. * Endpoint namespace.
  20. *
  21. * @var string
  22. */
  23. protected $namespace = 'wc/v3';
  24. /**
  25. * Get the settings schema, conforming to JSON Schema.
  26. *
  27. * @return array
  28. */
  29. public function get_item_schema() {
  30. // Get parent schema to append additional supported settings types for shipping zone method.
  31. $schema = parent::get_item_schema();
  32. // Append additional settings supported types (class, order).
  33. $schema['properties']['settings']['properties']['type']['enum'][] = 'class';
  34. $schema['properties']['settings']['properties']['type']['enum'][] = 'order';
  35. return $this->add_additional_fields_schema( $schema );
  36. }
  37. }