In this blog, we will learn how to modify the Cart Presenter values.
So let’s see together how to do that with PrestaShop.
Sometimes, we need to modify the cart presenter according to our needs.
Thanks to the available hooks, Prestashop gives a hook actionPresentCart
We will register this hook in the module.
$this->registerHook(
[
'actionPresentCart',
]
);
Now see below, The customer can add a promo code to get a discount

We can remove this apply promo code section using the PresentCart hook, see the below code
public function hookActionPresentCart($params)
{
$params['presentedCart']['vouchers']['allowed'] = 0;
}
We have overridden the voucher-allowed value and the customer can not apply the vouchers, see below

We can also override the Minimum purchase total required to validate the order.
Suppose the minimum purchase condition is 50 INR then the Customer can not place an order until the cart total has reached 50 INR and the customer will get the below screen

Now, we will add the below line code to override it in the PresentCart hook
$params['presentedCart']['minimalPurchase'] = 0.0; $params['presentedCart']['minimalPurchaseRequired'] = '';
You will see, that the minimum purchase condition is removed.

Like this, we can modify the all below values of Cart Presenter according to our needs.

That’s all about this blog. Hope it will help you.
If you are facing any issues or doubts in the above process, please feel free to contact us in the comment section.
We would be happy to help.
Also, you can explore our PrestaShop Development Services & a large range of quality PrestaShop Modules.
For any doubt contact us at support@webkul.com.

Be the first to comment.