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 1.7.7.1
$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
$this->translator->trans(
'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
],
'Shop.Theme.Checkout'
) :
''
];
In this way, the minimum purchase including taxes will be taken.
Greetings
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 1.7.7.1
$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
$this->translator->trans(
'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
],
'Shop.Theme.Checkout'
) :
''
];
In this way, the minimum purchase including taxes will be taken.
Greetings