Opencart 3.0.2 add to cart for registered users

Viewed 156

Hi how can I allow add to cart only register users and for non register user an alert should pop up urging users to log in or register. I am using this but is not working in controller/checkout/cart.php

if (!$this->customer->isLogged() && $this->config->get('config_customer_price')) {
                    $json['success'] = sprintf($this->language->get('text_login'), $this->url->link('account/login'), $this->url->link('account/register'));
                } else {
                    $this->cart->add($this->request->post['product_id'], $quantity, $option, $recurring_id);

                    $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart'));
                }
1 Answers

I resolve the issue removing this line && $this->config->get('config_customer_price') inside if

Related