WC_Product::set_tax_class( string $class )

Set the tax class.


Description Description


Parameters Parameters

$class

(Required) Tax class.


Top ↑

Source Source

File: includes/abstracts/abstract-wc-product.php

916
917
918
919
920
921
922
923
924
925
926
public function set_tax_class( $class ) {
    $class         = sanitize_title( $class );
    $class         = 'standard' === $class ? '' : $class;
    $valid_classes = $this->get_valid_tax_classes();
 
    if ( ! in_array( $class, $valid_classes, true ) ) {
        $class = '';
    }
 
    $this->set_prop( 'tax_class', $class );
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.