Only set valid tax classes in product abstract

This commit is contained in:
Mike Jolley 2017-08-18 17:06:22 +01:00
parent b0f190fa1d
commit d9f9e74bd9
1 changed files with 8 additions and 2 deletions

View File

@ -890,6 +890,12 @@ class WC_Product extends WC_Abstract_Legacy_Product {
public function set_tax_class( $class ) { public function set_tax_class( $class ) {
$class = sanitize_title( $class ); $class = sanitize_title( $class );
$class = 'standard' === $class ? '' : $class; $class = 'standard' === $class ? '' : $class;
$valid_classes = WC_Tax::get_tax_class_slugs();
if ( ! in_array( $class, $valid_classes ) ) {
$class = '';
}
$this->set_prop( 'tax_class', $class ); $this->set_prop( 'tax_class', $class );
} }