We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvement: Simplify Tax Calculation for custom adjustments.
Currently, if you're adding an additional (positive) adjustment to the cart item, you manually have to call the tax calculator:
$withTax = true; $taxCalculator = $this->taxCalculatorFactory->getTaxCalculator( $item->getProduct(), $cart->getShippingAddress() ?: $this->defaultAddressProvider->getAddress($cart), $context, ); if ($taxCalculator instanceof TaxCalculatorInterface) { $taxItems = $item->getTaxes() ?? new Fieldcollection(); if ($withTax) { $taxItems->setItems( $this->taxCollector->collectTaxesFromGross( $taxCalculator, $amountGrossTotal, $taxItems->getItems(), ), ); } else { $taxItems->setItems( $this->taxCollector->collectTaxes( $taxCalculator, $amountNetTotal, $taxItems->getItems(), ), ); } } $item->addAdjustment( $this->adjustmentFactory->createWithData( 'my_adjustment', '', $amountGrossTotal, $amountNetTotal, ) );
This is basically the same thing as CartItemRuleApplier and CartItemRuleApplier does.
CartItemRuleApplier
Proposal: Add a service which handles those things for us.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Improvement: Simplify Tax Calculation for custom adjustments.
Currently, if you're adding an additional (positive) adjustment to the cart item, you manually have to call the tax calculator:
This is basically the same thing as
CartItemRuleApplier
andCartItemRuleApplier
does.Proposal: Add a service which handles those things for us.
The text was updated successfully, but these errors were encountered: