Skip to content
New issue

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

As low as displays incorrect pricing on category page, tax appears to be added twice #21383 #21395

Merged

Conversation

Jitheesh
Copy link
Contributor

Description (*)

While calculating minimal price, MinimalTierPriceCalculator is applying tax twice.

public function getValue(SaleableInterface $saleableItem)
{
/** @var TierPrice $price */
$price = $saleableItem->getPriceInfo()->getPrice(TierPrice::PRICE_CODE);
$tierPriceList = $price->getTierPriceList();
$tierPrices = [];
foreach ($tierPriceList as $tierPrice) {
/** @var AmountInterface $price */
$price = $tierPrice['price'];
$tierPrices[] = $price->getValue();
}
return $tierPrices ? min($tierPrices) : null;
}

Above function is returning minimum price with tax, and then Magento is applying tax again while returning calculated amount of minimum price

public function getAmount(SaleableInterface $saleableItem)
{
$value = $this->getValue($saleableItem);
return $value === null
? null
: $this->calculator->getAmount($value, $saleableItem);
}
}

Issue can be fixed by excluding 'tax' while calculating return amount.

Fixed Issues (if relevant)

  1. As low as displays incorrect pricing on category page, tax appears to be added twice #21383: As low as displays incorrect pricing on category page, tax appears to be added twice

Manual testing scenarios (*)

  1. Create tax rules & rates
    1.1 Add 20% tax rate for UK shipping address
  2. Create product with tier price and tax class
  3. Set Stores->Configuration->Sales->Tax->Price Display Settings->Display Product Prices In Catalog to "Including and Excluding Tax".
  4. Create an account and add UK shipping as default address
  5. Check category listing page for newly created item
  6. Verify As low as price, it should be minimum tier price + tax

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team
Copy link
Contributor

Hi @Jitheesh. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@Jitheesh
Copy link
Contributor Author

@magento-engcom-team give me test instance

@magento-engcom-team
Copy link
Contributor

Hi @Jitheesh. Thank you for your request. I'm working on Magento instance for you

@magento-engcom-team
Copy link
Contributor

Hi @Jitheesh, here is your new Magento instance.
Admin access: https://pr-21395.instances.magento-community.engineering/admin
Login: admin Password: 123123q

@rogyar rogyar self-assigned this Feb 23, 2019
@rogyar
Copy link
Contributor

rogyar commented Feb 23, 2019

@magento-engcom-team
Copy link
Contributor

Hi @rogyar. Thank you for your request. I'm working on Magento instance for you

@magento-engcom-team
Copy link
Contributor

Hi @rogyar, here is your new Magento instance.
Admin access: https://pr-21395.instances.magento-community.engineering/admin
Login: admin Password: 123123q

@magento-engcom-team
Copy link
Contributor

Hi @rogyar, thank you for the review.
ENGCOM-4360 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@Jitheesh thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@ghost
Copy link

ghost commented Mar 1, 2019

Hi @Jitheesh, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants