Check tax display type before returning the tax lines (https://github.com/woocommerce/woocommerce-blocks/pull/7084)

* Check tax display type before returning the tax lines

* Return early if not itemized
This commit is contained in:
Hsing-yu Flowers 2022-09-23 13:33:12 -07:00 committed by GitHub
parent c2c639dee1
commit 04743add72
1 changed files with 6 additions and 1 deletions

View File

@ -387,8 +387,13 @@ class CartSchema extends AbstractSchema {
* @return array
*/
protected function get_tax_lines( $cart ) {
$tax_lines = [];
if ( 'itemized' !== get_option( 'woocommerce_tax_total_display' ) ) {
return $tax_lines;
}
$cart_tax_totals = $cart->get_tax_totals();
$tax_lines = [];
foreach ( $cart_tax_totals as $cart_tax_total ) {
$tax_lines[] = array(