opencart

Show price with tax for guests and without for logged in users


In OpenCart Store settings prices are shown with tax!

So it is okay. But when customer logged in, I need it without tax on product page and in category.

How can I modify OpenCart to do this?


Solution

  • Hello @Ivan go to the catalog/controller/product.php and in your public function index() search for the

    if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { 
    
        $data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);  `
    
        }else {  
         $data['price'] = false;
        }
    

    Change it to :

    if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { 
        $data['price'] = $this->currency->format($product_info['price'], $this->session->data['currency']); 
    
    }else {  
     $data['price'] = false;
    }