WC_API_Taxes::register_routes()
Register the routes for this class
GET /taxes GET /taxes/count GET /taxes/<id>
Method of the class: WC_API_Taxes{}
No Hooks.
Return
Array
.
Usage
$WC_API_Taxes = new WC_API_Taxes(); $WC_API_Taxes->register_routes( $routes );
- $routes(array) (required)
- -
Changelog
Since 2.1 | Introduced. |
WC_API_Taxes::register_routes() WC API Taxes::register routes code WC 7.7.0
public function register_routes( $routes ) { # GET/POST /taxes $routes[ $this->base ] = array( array( array( $this, 'get_taxes' ), WC_API_Server::READABLE ), array( array( $this, 'create_tax' ), WC_API_Server::CREATABLE | WC_API_Server::ACCEPT_DATA ), ); # GET /taxes/count $routes[ $this->base . '/count' ] = array( array( array( $this, 'get_taxes_count' ), WC_API_Server::READABLE ), ); # GET/PUT/DELETE /taxes/<id> $routes[ $this->base . '/(?P<id>\d+)' ] = array( array( array( $this, 'get_tax' ), WC_API_Server::READABLE ), array( array( $this, 'edit_tax' ), WC_API_SERVER::EDITABLE | WC_API_SERVER::ACCEPT_DATA ), array( array( $this, 'delete_tax' ), WC_API_SERVER::DELETABLE ), ); # GET/POST /taxes/classes $routes[ $this->base . '/classes' ] = array( array( array( $this, 'get_tax_classes' ), WC_API_Server::READABLE ), array( array( $this, 'create_tax_class' ), WC_API_Server::CREATABLE | WC_API_Server::ACCEPT_DATA ), ); # GET /taxes/classes/count $routes[ $this->base . '/classes/count' ] = array( array( array( $this, 'get_tax_classes_count' ), WC_API_Server::READABLE ), ); # GET /taxes/classes/<slug> $routes[ $this->base . '/classes/(?P<slug>\w[\w\s\-]*)' ] = array( array( array( $this, 'delete_tax_class' ), WC_API_SERVER::DELETABLE ), ); # POST|PUT /taxes/bulk $routes[ $this->base . '/bulk' ] = array( array( array( $this, 'bulk' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ), ); return $routes; }