Jump to content

Recommended Posts

I had the problem for a client and decided to investigate. I found old post, so create this new one to help whoever may need it now.

The problem is that when using the minimum purchase that Prestashop has in "Store parameters -> Order configuration" this is compared with the total of products with taxes excluded and I needed to include taxes in the minimum purchase. Although it is not the best practice, I have found the solution by modifying the /src/Adapter/Presenter/Cart/CartPresenter.php file to add a new variable with the total of products including taxes and thus replace the one that does not have taxes in the validation below.

Added after line 327 in Prestashop

$productsTotalIncludingTax = $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS);//Added by Nimeos.co

Once we have the variable, we replace it in the validation and assignment of the "minimalPurchaseRequired" index at the end of the present() function of the same file.

return [
  'products' => $products,
  'totals' => $totals,
  'subtotals' => $subtotals,
  'products_count' => $products_count,
  'summary_string' => $summary_string,
  'labels' => $labels,
  'id_address_delivery' => $cart->id_address_delivery,
  'id_address_invoice' => $cart->id_address_invoice,
  'is_virtual' => $cart->isVirtualCart(),
  'vouchers' => $vouchers,
  'discounts' => $discounts,
  'minimalPurchase' => $minimalPurchase,
  'minimalPurchaseRequired' => ($productsTotalIncludingTax < $minimalPurchase) ?//Mod by Nimeos.co
      'A minimum shopping cart total of %amount% (tax excl.) is required to validate your order. Current cart total is %total% (tax excl.).',
      '%amount%' => $this->priceFormatter->format($minimalPurchase),
      '%total%' => $this->priceFormatter->format($productsTotalIncludingTax),//Mod by Nimeos.co
    ) :

In this way, the minimum purchase including taxes will be taken.


Christian Ramírez
CEO at Nimeos.co

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More