Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Variables
tax_rule.php File Reference

Go to the source code of this file.

Variables

 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
 
 $customerTaxClass = $objectManager->create(\Magento\Tax\Model\ClassModel::class)->load('Retail Customer', 'class_name')
 
 $productTaxClass1 = $objectManager->create(\Magento\Tax\Model\ClassModel::class)->load('Taxable Goods', 'class_name')
 
 $taxRate
 
 $rate = $objectManager->create(\Magento\Tax\Model\Calculation\Rate::class)->setData($taxRate)->save()
 
 $registry = $objectManager->get(\Magento\Framework\Registry::class)
 
 $ruleData
 
 $taxRule = $objectManager->create(\Magento\Tax\Model\Calculation\Rule::class)->setData($ruleData)->save()
 

Variable Documentation

◆ $customerTaxClass

$customerTaxClass = $objectManager->create(\Magento\Tax\Model\ClassModel::class)->load('Retail Customer', 'class_name')

Definition at line 9 of file tax_rule.php.

◆ $objectManager

Definition at line 8 of file tax_rule.php.

◆ $productTaxClass1

$productTaxClass1 = $objectManager->create(\Magento\Tax\Model\ClassModel::class)->load('Taxable Goods', 'class_name')

Definition at line 10 of file tax_rule.php.

◆ $rate

$rate = $objectManager->create(\Magento\Tax\Model\Calculation\Rate::class)->setData($taxRate)->save()

Definition at line 19 of file tax_rule.php.

◆ $registry

$registry = $objectManager->get(\Magento\Framework\Registry::class)

Definition at line 22 of file tax_rule.php.

◆ $ruleData

$ruleData
Initial value:
= [
'code' => 'Test Rule',
'priority' => '0',
'position' => '0',
'customer_tax_class_ids' => [$customerTaxClass->getId()],
'product_tax_class_ids' => [$productTaxClass1->getId()],
'tax_rate_ids' => [$rate->getId()],
]
$rate
Definition: tax_rule.php:19
$customerTaxClass
Definition: tax_rule.php:9
$productTaxClass1
Definition: tax_rule.php:10

Definition at line 26 of file tax_rule.php.

◆ $taxRate

$taxRate
Initial value:
= [
'tax_country_id' => 'US',
'tax_region_id' => '0',
'tax_postcode' => '*',
'code' => '*',
'rate' => '10',
]

Definition at line 12 of file tax_rule.php.

◆ $taxRule

$taxRule = $objectManager->create(\Magento\Tax\Model\Calculation\Rule::class)->setData($ruleData)->save()

Definition at line 35 of file tax_rule.php.