public function address() { $type = \CI::input()->post('type'); $id = \CI::input()->post('id'); $address = \CI::Customers()->get_address($id); if ($address['customer_id'] != $this->customer->id) { echo json_encode(['error' => lang('error_address_not_found')]); } else { if ($type == 'shipping') { \GC::setAttribute('shipping_address_id', $id); } elseif ($type == 'billing') { \GC::setAttribute('billing_address_id', $id); } \GC::saveCart(); echo json_encode(['success' => true]); } }