Automattic\WooCommerce\StoreApi\Routes\V1
ProductAttributeTerms::get_route_response
Get a collection of attribute terms.
Method of the class: ProductAttributeTerms{}
No Hooks.
Returns
\WP_REST_Response.
Usage
// protected - for code of main (parent) or child class $result = $this->get_route_response( $request );
- $request(WP_REST_Request) (required)
- Request object.
ProductAttributeTerms::get_route_response() ProductAttributeTerms::get route response code WC 10.5.0
protected function get_route_response( \WP_REST_Request $request ) {
$attribute = wc_get_attribute( $request['attribute_id'] );
if ( ! $attribute || ! taxonomy_exists( $attribute->slug ) ) {
throw new RouteException( 'woocommerce_rest_taxonomy_invalid', __( 'Attribute does not exist.', 'woocommerce' ), 404 );
}
return $this->get_terms_response( $attribute->slug, $request );
}