WC_REST_Tax_Classes_V1_Controller::get_items()
Get all tax classes.
Метод класса: WC_REST_Tax_Classes_V1_Controller{}
Хуков нет.
Возвращает
Массив
.
Использование
$WC_REST_Tax_Classes_V1_Controller = new WC_REST_Tax_Classes_V1_Controller(); $WC_REST_Tax_Classes_V1_Controller->get_items( $request );
- $request(WP_REST_Request) (обязательный)
- Full details about the request.
Код WC_REST_Tax_Classes_V1_Controller::get_items() WC REST Tax Classes V1 Controller::get items WC 9.3.3
public function get_items( $request ) { $tax_classes = array(); // Add standard class. $tax_classes[] = array( 'slug' => 'standard', 'name' => __( 'Standard rate', 'woocommerce' ), ); $classes = WC_Tax::get_tax_classes(); foreach ( $classes as $class ) { $tax_classes[] = array( 'slug' => sanitize_title( $class ), 'name' => $class, ); } $data = array(); foreach ( $tax_classes as $tax_class ) { $class = $this->prepare_item_for_response( $tax_class, $request ); $class = $this->prepare_response_for_collection( $class ); $data[] = $class; } return rest_ensure_response( $data ); }