Skip to content
This repository was archived by the owner on Apr 22, 2019. It is now read-only.

Commit 196aadd

Browse files
committed
Added configuration field for shipping tax code. Default to old constant value.
1 parent 6536f43 commit 196aadd

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

Helper/Config.php

+18
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ class Config extends AbstractHelper
132132
const XML_PATH_AVATAX_ADMIN_NOTIFICATION_IGNORE_NATIVE_TAX_RULES = 'tax/avatax/ignore_native_tax_rules_notification';
133133

134134
const XML_PATH_AVATAX_ADMIN_IS_SELLER_IMPORTER_OF_RECORD = 'tax/avatax/is_seller_importer_of_record';
135+
136+
const XML_PATH_AVATAX_SHIPPING_TAX_CODE = 'tax/avatax/shipping_tax_code';
135137
/**#@-*/
136138

137139
/**
@@ -1072,4 +1074,20 @@ public function isSellerImporterOfRecord($originAddress, $destAddress, $storeId)
10721074
}
10731075
return $isSellerImporterOfRecord;
10741076
}
1077+
1078+
/**
1079+
* Get Shipping Tax Code.
1080+
*
1081+
* @param $store
1082+
*
1083+
* @return string
1084+
*/
1085+
public function getShippingTaxCode($store = null)
1086+
{
1087+
return $this->scopeConfig->getValue(
1088+
self::XML_PATH_AVATAX_SHIPPING_TAX_CODE,
1089+
ScopeInterface::SCOPE_STORE,
1090+
$store
1091+
);
1092+
}
10751093
}

Helper/TaxClass.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
*/
2424
class TaxClass
2525
{
26-
/**
27-
* Avatax shipping tax code
28-
*/
29-
const SHIPPING_LINE_AVATAX_TAX_CODE = 'FR020100';
30-
3126
/**
3227
* Avatax gift certificate tax code
3328
*/
@@ -177,12 +172,13 @@ public function getRef2ForProduct(\Magento\Catalog\Model\Product $product)
177172

178173
/**
179174
* Get AvaTax Tax Code for shipping
175+
* Default Configuration Setting: FR020100
180176
*
181177
* @return string
182178
*/
183179
public function getAvataxTaxCodeForShipping()
184180
{
185-
return self::SHIPPING_LINE_AVATAX_TAX_CODE;
181+
return $this->config->getShippingTaxCode();
186182
}
187183

188184
/**

etc/adminhtml/system.xml

+8
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,14 @@
230230
<depends>
231231
<field id="enabled">1</field>
232232
</depends>
233+
</field>
234+
<field id="shipping_tax_code" translate="label" type="text" sortOrder="3065" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
235+
<config_path>tax/avatax/shipping_tax_code</config_path>
236+
<label>Shipping Tax Code</label>
237+
<comment>The Avalara tax code used to classify the shipping service type.</comment>
238+
<depends>
239+
<field id="enabled">1</field>
240+
</depends>
233241
</field>
234242
<field id="sku_shipping" translate="label" type="text" sortOrder="3070" showInDefault="1" showInWebsite="1" showInStore="1">
235243
<label>Shipping SKU</label>

etc/config.xml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<tax_calculation_countries_enabled>CA,US</tax_calculation_countries_enabled>
2525
<is_seller_importer_of_record>0</is_seller_importer_of_record>
2626
<use_business_identification_number>1</use_business_identification_number>
27+
<shipping_tax_code>FR020100</shipping_tax_code>
2728
<sku_shipping>Shipping</sku_shipping>
2829
<sku_gift_wrap_order>GwOrder</sku_gift_wrap_order>
2930
<sku_gift_wrap_item>GwItems</sku_gift_wrap_item>

0 commit comments

Comments
 (0)