# How to include customer BARCODE on Invoice

**URL:** <https://www.dolibarr.org/forum/t/how-to-include-customer-barcode-on-invoice/17033>\
**Category:** Using my Dolibarr\
**Created:** [October 19, 2018, 9:20am UTC](https://www.dolibarr.org/forum/t/how-to-include-customer-barcode-on-invoice/17033 "2018-10-19T09:20:29Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![GhanshyamParmar](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/ghanshyamparmar/32/9018_2.png) [@GhanshyamParmar](https://www.dolibarr.org/forum/u/GhanshyamParmar)\
**Post date:** [November 25, 2025, 8:16am UTC](https://www.dolibarr.org/forum/t/how-to-include-customer-barcode-on-invoice/17033/5 "2025-11-25T08:16:49Z")

</div>

find this code

// Description of product line  
if ($this-\>getColumnStatus(‘desc’)) {  
if ($object-\>lines[$i]-\>special\_code != SUBTOTALS\_SPECIAL\_CODE) {  
$this-\>printColDescContent($pdf, $curY, ‘desc’, $object, $i, $outputlangs, $hideref, $hidedesc);  
$this-\>setAfterColsLinePositionsData(‘desc’, $pdf-\>GetY(), $pdf-\>getPage());

after this add

if (!getDolGlobalString(‘MAIN\_GENERATE\_DOCUMENTS\_SHOW\_PRODUCT\_BARCODE’) && !empty($this-\>getBarcode($object-\>lines[$i]-\>fk\_product))) {  
$code = $this-\>getBarcode($object-\>lines[$i]-\>fk\_product);  
$barcodeType = ‘C128’;  
$pdf-\>setXY($this-\>getColumnContentXStart(‘desc’),$curY + 15);  
//$pdf-\>write2DBarcode($code, ‘QRCODE,M’, $this-\>getColumnContentXStart(‘desc’) , $curY + 15, 20, 20, $styleQr, ‘N’);  
$pdf-\>write1DBarcode($code, $barcodeType, $this-\>getColumnContentXStart(‘desc’) , $curY + 13, 70, 10, 0.4, array(‘position’=\>‘S’, ‘border’=\>false, ‘padding’=\>1, ‘fgcolor’=\>array(0,0,0), ‘text’=\>false, ‘font’=\>‘helvetica’, ‘fontsize’=\>8, ‘stretchtext’=\>2), ‘N’);  
$this-\>setAfterColsLinePositionsData(‘desc’, $nexY, $pdf-\>getPage());  
$this-\>setAfterColsLinePositionsData(‘desc’, $pdf-\>GetY(), $pdf-\>getPage());  
}

and place this code to get product barcode data outside this function

```auto
public function getBarcode($id)
	{
	$sql = "SELECT barcode FROM ".MAIN_DB_PREFIX."product";
	$sql .= " WHERE rowid = ".((int) $id);
	dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
	$resql = $this->db->query($sql);
	if ($resql) {
		$row = $this->db->fetch_row($resql);
		$result = $row[0];
		}
	return $result;
	}

```

 ![image](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/f/fa27ecd2c7c0a6092d1f064a6c2257d1f6af4d0c.png)

---

_[View the full topic](https://www.dolibarr.org/forum/t/how-to-include-customer-barcode-on-invoice/17033)._
