Merge pull request #29218 from wywarren/fix/27553

Fix for issue #27553 - REST API v3 not supporting settings type `order` and `class` for settings type on shipping zone methods
This commit is contained in:
Roy Ho 2021-03-11 09:22:34 -08:00 committed by GitHub
commit ee90c02f63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -24,4 +24,20 @@ class WC_REST_Shipping_Zone_Methods_Controller extends WC_REST_Shipping_Zone_Met
* @var string * @var string
*/ */
protected $namespace = 'wc/v3'; protected $namespace = 'wc/v3';
/**
* Get the settings schema, conforming to JSON Schema.
*
* @return array
*/
public function get_item_schema() {
// Get parent schema to append additional supported settings types for shipping zone method.
$schema = parent::get_item_schema();
// Append additional settings supported types (class, order).
$schema['properties']['settings']['properties']['type']['enum'][] = 'class';
$schema['properties']['settings']['properties']['type']['enum'][] = 'order';
return $this->add_additional_fields_schema( $schema );
}
} }