WC_Settings_Tax::output_tax_rates() public WC 1.0
Output tax rate tables.
{} Это метод класса: WC_Settings_Tax{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$WC_Settings_Tax = new WC_Settings_Tax(); $WC_Settings_Tax->output_tax_rates();
Код WC_Settings_Tax::output_tax_rates() WC Settings Tax::output tax rates WC 5.0.0
public function output_tax_rates() {
global $current_section;
$current_class = $this->get_current_tax_class();
$countries = array();
foreach ( WC()->countries->get_allowed_countries() as $value => $label ) {
$countries[] = array(
'value' => $value,
'label' => esc_js( html_entity_decode( $label ) ),
);
}
$states = array();
foreach ( WC()->countries->get_allowed_country_states() as $label ) {
foreach ( $label as $code => $state ) {
$states[] = array(
'value' => $code,
'label' => esc_js( html_entity_decode( $state ) ),
);
}
}
$base_url = admin_url(
add_query_arg(
array(
'page' => 'wc-settings',
'tab' => 'tax',
'section' => $current_section,
),
'admin.php'
)
);
// Localize and enqueue our js.
wp_localize_script(
'wc-settings-tax',
'htmlSettingsTaxLocalizeScript',
array(
'current_class' => $current_class,
'wc_tax_nonce' => wp_create_nonce( 'wc_tax_nonce-class:' . $current_class ),
'base_url' => $base_url,
'rates' => array_values( WC_Tax::get_rates_for_tax_class( $current_class ) ),
'page' => ! empty( $_GET['p'] ) ? absint( $_GET['p'] ) : 1,
'limit' => 100,
'countries' => $countries,
'states' => $states,
'default_rate' => array(
'tax_rate_id' => 0,
'tax_rate_country' => '',
'tax_rate_state' => '',
'tax_rate' => '',
'tax_rate_name' => '',
'tax_rate_priority' => 1,
'tax_rate_compound' => 0,
'tax_rate_shipping' => 1,
'tax_rate_order' => null,
'tax_rate_class' => $current_class,
),
'strings' => array(
'no_rows_selected' => __( 'No row(s) selected', 'woocommerce' ),
'unload_confirmation_msg' => __( 'Your changed data will be lost if you leave this page without saving.', 'woocommerce' ),
'csv_data_cols' => array(
__( 'Country code', 'woocommerce' ),
__( 'State code', 'woocommerce' ),
__( 'Postcode / ZIP', 'woocommerce' ),
__( 'City', 'woocommerce' ),
__( 'Rate %', 'woocommerce' ),
__( 'Tax name', 'woocommerce' ),
__( 'Priority', 'woocommerce' ),
__( 'Compound', 'woocommerce' ),
__( 'Shipping', 'woocommerce' ),
__( 'Tax class', 'woocommerce' ),
),
),
)
);
wp_enqueue_script( 'wc-settings-tax' );
include __DIR__ . '/views/html-settings-tax.php';
}