WC_Product::set_tax_status()publicWC 3.0.0

Set the tax status.

Method of the class: WC_Product{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Product = new WC_Product();
$WC_Product->set_tax_status( $status );
$status(string) (required)
Tax status.

Changelog

Since 3.0.0 Introduced.

WC_Product::set_tax_status() code WC 8.7.0

public function set_tax_status( $status ) {
	$options = array(
		'taxable',
		'shipping',
		'none',
	);

	// Set default if empty.
	if ( empty( $status ) ) {
		$status = 'taxable';
	}

	$status = strtolower( $status );

	if ( ! in_array( $status, $options, true ) ) {
		$this->error( 'product_invalid_tax_status', __( 'Invalid product tax status.', 'woocommerce' ) );
	}

	$this->set_prop( 'tax_status', $status );
}