From f244b178d3510003b2720f1071ae9c07345c1d35 Mon Sep 17 00:00:00 2001 From: JeroenSormani Date: Fri, 13 Oct 2017 18:06:23 +0200 Subject: [PATCH] Allow tax_class slugs when adding a fee --- includes/class-wc-cart-fees.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-cart-fees.php b/includes/class-wc-cart-fees.php index 039cdcf03b0..1feecadcce3 100644 --- a/includes/class-wc-cart-fees.php +++ b/includes/class-wc-cart-fees.php @@ -77,7 +77,7 @@ final class WC_Cart_Fees { public function add_fee( $args = array() ) { $fee_props = (object) wp_parse_args( $args, $this->default_fee_props ); $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->amount = wc_format_decimal( $fee_props->amount );