Only set valid tax classes in product abstract
This commit is contained in:
parent
b0f190fa1d
commit
d9f9e74bd9
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue