Allow tax_class slugs when adding a fee
This commit is contained in:
parent
0f9bd218ed
commit
f244b178d3
|
@ -77,7 +77,7 @@ final class WC_Cart_Fees {
|
||||||
public function add_fee( $args = array() ) {
|
public function add_fee( $args = array() ) {
|
||||||
$fee_props = (object) wp_parse_args( $args, $this->default_fee_props );
|
$fee_props = (object) wp_parse_args( $args, $this->default_fee_props );
|
||||||
$fee_props->name = $fee_props->name ? $fee_props->name : __( 'Fee', 'woocommerce' );
|
$fee_props->name = $fee_props->name ? $fee_props->name : __( 'Fee', 'woocommerce' );
|
||||||
$fee_props->tax_class = in_array( $fee_props->tax_class, WC_Tax::get_tax_classes(), true ) ? $fee_props->tax_class: '';
|
$fee_props->tax_class = in_array( $fee_props->tax_class, array_merge( WC_Tax::get_tax_classes(), WC_Tax::get_tax_class_slugs() ), true ) ? $fee_props->tax_class: '';
|
||||||
$fee_props->taxable = wc_string_to_bool( $fee_props->taxable );
|
$fee_props->taxable = wc_string_to_bool( $fee_props->taxable );
|
||||||
$fee_props->amount = wc_format_decimal( $fee_props->amount );
|
$fee_props->amount = wc_format_decimal( $fee_props->amount );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue