WordPress at Your Fingertips
function is not described

WC_Settings_Tax::get_posted_tax_rate() private WC 1.0

Get a posted tax rate.

{} It's a method of the class: WC_Settings_Tax{}

No Hooks.

Return

Array.

Usage

// private - for code of main (parent) class only
$result = $this->get_posted_tax_rate( $key, $order, $class );
$key(string) (required)
Key of tax rate in the post data array.
$order(int) (required)
Position/order of rate.
$class(string) (required)
Tax class for rate.

Code of WC_Settings_Tax::get_posted_tax_rate() WC 5.9.0

private function get_posted_tax_rate( $key, $order, $class ) {
	// phpcs:disable WordPress.Security.NonceVerification.Missing -- this is called from 'save_tax_rates' only, where nonce is already verified.
	$tax_rate      = array();
	$tax_rate_keys = array(
		'tax_rate_country',
		'tax_rate_state',
		'tax_rate',
		'tax_rate_name',
		'tax_rate_priority',
	);

	// phpcs:disable WordPress.Security.NonceVerification.Missing
	foreach ( $tax_rate_keys as $tax_rate_key ) {
		if ( isset( $_POST[ $tax_rate_key ], $_POST[ $tax_rate_key ][ $key ] ) ) {
			$tax_rate[ $tax_rate_key ] = wc_clean( wp_unslash( $_POST[ $tax_rate_key ][ $key ] ) );
		}
	}

	$tax_rate['tax_rate_compound'] = isset( $_POST['tax_rate_compound'][ $key ] ) ? 1 : 0;
	$tax_rate['tax_rate_shipping'] = isset( $_POST['tax_rate_shipping'][ $key ] ) ? 1 : 0;
	$tax_rate['tax_rate_order']    = $order;
	$tax_rate['tax_rate_class']    = $class;
	// phpcs:enable WordPress.Security.NonceVerification.Missing

	return $tax_rate;
	// phpcs:enable WordPress.Security.NonceVerification.Missing
}