Opencart- Minimum Checkout Value

31 Views Asked by At

I have opencart V3.0.3.8 - I have added the below code at catalog\controller\checkout\checkout.php to make min. checkout value £25.00 but doesn't work.

if ((!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) || (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout'))) {
      $this->response->redirect($this->url->link('checkout/cart'));
}

/* new code to set a mimimum shopping cart value of GBP £25.00
if ($this->cart->getSubtotal() < 2500){
    $this->session->data['error'] = 'Please note: there is a minimum shopping cart value of £25.00 before shipping and tax for you to proceed to checkout.';
     $this->response->redirect($this->url->link('checkout/cart'));
}
*/
1

There are 1 best solutions below

1
K. B. On

Your code

if ($this->cart->getSubtotal() < 2500){
        $this->session->data['error'] = 'Please note: there is a minimum shopping cart value of £25.00 before shipping and tax for you to proceed to checkout.';
         $this->response->redirect($this->url->link('checkout/cart'));
    }

must be. You forgot separate decimal by dot

if ($this->cart->getSubtotal() < 25.00){
    $this->session->data['error'] = 'Please note: there is a minimum shopping cart value of £25.00 before shipping and tax for you to proceed to checkout.';
     $this->response->redirect($this->url->link('checkout/cart'));
}