public function getTaxRules()
    {
        $rules = [];
        /* @var \Magento\Tax\Model\Calculation\Rule $rule */
        foreach ($this->taxRules as $rule) {
            $_rule = [
                'id'                   => $rule->getId(),
                'name'                 => $rule->getCode(),
                'priority'             => $rule->getPriority(),
                'product_tax_classes'  => [],
                'customer_tax_classes' => [],
                'tax_rates'            => [],
            ];

            foreach (array_unique($rule->getProductTaxClasses()) as $taxClass) {
                $_rule['product_tax_classes'][] = [
                    'id'  => $taxClass,
                    'key' => $taxClass
                ];
            }

            foreach (array_unique($rule->getCustomerTaxClasses()) as $taxClass) {
                $_rule['customer_tax_classes'][] = [
                    'id'  => $taxClass,
                    'key' => $taxClass
                ];
            }

            foreach (array_unique($rule->getRates()) as $taxRates) {
                $_rule['tax_rates'][] = [
                    'id'  => $taxRates,
                    'key' => $taxRates
                ];
            }

            $rules[] = $_rule;
        }

        return $rules;
    }
public function getTaxRules()
    {
        $rules = [];
        /* @var \Magento\Tax\Model\Calculation\Rule $rule */
        foreach ($this->taxRules as $rule) {
            $_rule = [
                'id'                   => $rule->getId(),
                'name'                 => $rule->getCode(),
                'priority'             => $rule->getPriority(),
                'product_tax_classes'  => [],
                'customer_tax_classes' => [],
                'tax_rates'            => [],
            ];

            foreach (array_unique($rule->getProductTaxClasses()) as $taxClass) {
                $_rule['product_tax_classes'][] = [
                    'id'  => $taxClass,
                    'key' => $taxClass
                ];
            }

            foreach (array_unique($rule->getCustomerTaxClasses()) as $taxClass) {
                $_rule['customer_tax_classes'][] = [
                    'id'  => $taxClass,
                    'key' => $taxClass
                ];
            }

            foreach (array_unique($rule->getRates()) as $taxRates) {
                $_rule['tax_rates'][] = [
                    'id'  => $taxRates,
                    'key' => $taxRates
                ];
            }

            $rules[] = $_rule;
        }

        return $rules;
    }
public function getTaxRules ( ) { $ rules = [ ] ; /* @var \Magento\Tax\Model\Calculation\Rule $rule */ foreach ( $ this -> taxRules as $ rule ) { $ _rule = [ 'id' => $ rule -> getId ( ) , 'name' => $ rule -> getCode ( ) , 'priority' => $ rule -> getPriority ( ) , 'product_tax_classes' => [ ] , 'customer_tax_classes' => [ ] , 'tax_rates' => [ ] , ] ; foreach ( array_unique ( $ rule -> getProductTaxClasses ( ) ) as $ taxClass ) { $ _rule [ 'product_tax_classes' ] [ ] = [ 'id' => $ taxClass , 'key' => $ taxClass ] ; } foreach ( array_unique ( $ rule -> getCustomerTaxClasses ( ) ) as $ taxClass ) { $ _rule [ 'customer_tax_classes' ] [ ] = [ 'id' => $ taxClass , 'key' => $ taxClass ] ; } foreach ( array_unique ( $ rule -> getRates ( ) ) as $ taxRates ) { $ _rule [ 'tax_rates' ] [ ] = [ 'id' => $ taxRates , 'key' => $ taxRates ] ; } $ rules [ ] = $ _rule ; } return $ rules ; }
Retrieve Magento tax rules for
Merchant API to pick up

@return array
Retrieve Magento tax rules for Merchant API to pick up