WC_API_Coupons::register_routes()
Register the routes for this class
GET /coupons GET /coupons/count GET /coupons/<id>
Метод класса: WC_API_Coupons{}
Хуков нет.
Возвращает
Массив
.
Использование
$WC_API_Coupons = new WC_API_Coupons(); $WC_API_Coupons->register_routes( $routes );
- $routes(массив) (обязательный)
- -
Список изменений
С версии 2.1 | Введена. |
Код WC_API_Coupons::register_routes() WC API Coupons::register routes WC 8.1.1
public function register_routes( $routes ) { # GET /coupons $routes[ $this->base ] = array( array( array( $this, 'get_coupons' ), WC_API_Server::READABLE ), ); # GET /coupons/count $routes[ $this->base . '/count' ] = array( array( array( $this, 'get_coupons_count' ), WC_API_Server::READABLE ), ); # GET /coupons/<id> $routes[ $this->base . '/(?P<id>\d+)' ] = array( array( array( $this, 'get_coupon' ), WC_API_Server::READABLE ), ); # GET /coupons/code/<code>, note that coupon codes can contain spaces, dashes and underscores $routes[ $this->base . '/code/(?P<code>\w[\w\s\-]*)' ] = array( array( array( $this, 'get_coupon_by_code' ), WC_API_Server::READABLE ), ); return $routes; }