Jump to content

How to display the required amount in the cart to benefit from a voucher code?


Talas

Recommended Posts

Hello,

I'm using Prestashop 1.7.5.0.

I am trying to display the minimum amount to reach in the cart to benefit from a voucher code.

By default, when you indicate a promo code, the following text is displayed "Your order does not reach the amount...".

Is there a smarty variable that displays the minimum amount required?

Thank you.

Link to comment
Share on other sites

This isn't an ideal solution as this modifies a core class but I'm sure you could do it with an override if you'd prefer. This was just the quickest method I could come up with so certainly not the best ;)

With that said, that message is created in the checkValidity method of the CartRule class:

if ($cartTotal < $minimum_amount) {
                return (!$display_error) ? false : $this->trans('You have not reached the minimum amount required to use this voucher', array(), 'Shop.Notifications.Error');
            }

You could just add it onto the end of the string that's returned, like:

if ($cartTotal < $minimum_amount) {
                return (!$display_error) ? false : $this->trans('You have not reached the minimum amount required to use this voucher', [], 'Shop.Notifications.Error') . ' The minimum amount is ' . $context->currentLocale->formatPrice($minimum_amount, $context->currency->iso_code);
            }

Like I said, by no means a great solution but it works 😕 

Link to comment
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...