Automattic\WooCommerce\Internal\Features\ProductBlockEditor\ProductTemplates
SimpleProductTemplate::get_tax_classes()
Get the tax classes as select options.
Метод класса: SimpleProductTemplate{}
Хуков нет.
Возвращает
Массив
. Array of options.
Использование
$result = SimpleProductTemplate::get_tax_classes( $post_type );
- $post_type(строка)
- The post type.
По умолчанию: 'product'
Код SimpleProductTemplate::get_tax_classes() SimpleProductTemplate::get tax classes WC 9.7.1
public static function get_tax_classes( $post_type = 'product' ) { $tax_classes = array(); if ( 'product_variation' === $post_type ) { $tax_classes[] = array( 'label' => __( 'Same as main product', 'woocommerce' ), 'value' => 'parent', ); } // Add standard class. $tax_classes[] = array( 'label' => __( 'Standard rate', 'woocommerce' ), 'value' => '', ); $classes = WC_Tax::get_tax_rate_classes(); foreach ( $classes as $tax_class ) { $tax_classes[] = array( 'label' => $tax_class->name, 'value' => $tax_class->slug, ); } return $tax_classes; }