Problem/Motivation
In #3310714: Properly process complex tax responses, when possible, each tax line returned by AvaTax gets it's own line on the order. However, some merchants prefer the simple "Sales tax" line.
Proposed resolution
Let's make this a configuration option. It can be added to the Advanced section of the AvaTax configuration form.
Remaining tasks
- Add a checkbox to the configuration form.
- Add a boolean to the commerce_avatax.schema.yml
- Add a condition to
">Drupal\commerce_avatax\Plugin\Commerce\TaxType::apply()
User interface changes
An optionally simplified tax line on the order.
Data model changes
commerce_avatax.schema.yml
commerce_avatax.settings:
mapping:
combine_lines:
type: boolean
label: 'Combine tax lines'
Comments
Comment #2
djween commentedThis is definitely needed as state and county tax are split on separate line items (which is not the ecommerce norm) for US tax and it confuses the end user customer.
Comment #4
scottsawyerOk, what the MR does is add a toggle in the Avatax setting to consolidate taxes. It also provides a "label" field, so you can call your taxes whatever you want.
Then, on the order, in the apply() method, it simply renames all of the taxes to whatever you named it. Commerce will automatically combine exact match adjustments (ignoring the amount). This has the effect of consolidating the tax lines on the order.
Comment #7
jsacksick commented@scottsawyer: Trusting you on this one, though I suspect the following line might be problematic:
$label = $config->get('combine_tax_lines_label') ?? $this->t('Sales tax');As "combine_tax_lines_label" is an empty string by default (and the "??" operator works for NULL values).
Perhaps it should have been:
instead, but since you have a :required state (which in my experience was buggy in the past), it shouldn't be a problem hopefully.
Comment #10
jsacksick commentedThis was discussed internally and it was finally decided to revert the MR for the following reasons:
Comment #11
scottsawyerThanks for your consideration and feedback, we will certainly look into the options you presented. Though, I have to say, I find some of the reasoning behind rejecting the current implementation a bit flimsy.
Anyway, this is a source of contention for our customer for a while now, so we'll keep looking into alternative approaches.
Comment #12
rhovlandI agree that this should be a display option and not actually touch the underlying tax information. The problem (which we've had customers debate with us about because they're "tax experts") is the split lines display of taxes on the order/checkout not what gets recorded with avatax.
This probably means a feature in commerce_tax, not here, that combines the display of tax adjustments when configured to do so.