Setting Up Automated QR Code Generation for Products in 1C-Bitrix
When launching a retail point with a QR code showcase or labeling packages for the warehouse, the task arises: generate a unique code for each product unit. Manual creation of thousands of images is not an option. We configure automatic QR code generation in Bitrix turnkey: from library selection to integration with warehouse processes. Contact us to evaluate your project.
The main difficulties we solve: high load during mass generation (1000+ products), need to support different formats (PNG, SVG) and ensure code readability on packaging. Our experience shows that properly configured generation saves up to 80% of a manager's time. Without automation, managers spend hours creating QR via third-party services, and when updating prices or descriptions, codes have to be regenerated manually. We develop a solution that integrates with your catalog and generates codes on the fly or on a schedule. As a result, you get ready-to-print PNG with company logo and short links for conversion tracking. Automation of QR code generation pays off on average in 2-3 months of warehouse operation, and in monetary terms, savings can amount to up to 40,000 rubles per month. The cost of developing such integration starts from 50,000 rubles, and the economic effect reaches 200,000 rubles per year.
Library selection for QR generation
1C-Bitrix does not have a built-in QR code generator. A third-party library is connected via Composer. Two popular options:
endroid/qr-code provides rich functionality: support for PNG with logo, multiple error correction levels, work with different encodings. chillerlan/php-qrcode is lighter and faster, does not require the GD extension. Compared to chillerlan, endroid is 3 times more feature-rich and supports branding.
| Feature | endroid/qr-code | chillerlan/php-qrcode |
|---|---|---|
| Package size | ~500 KB | ~100 KB |
| PNG with logo | Yes | No |
| SVG support | Yes | No |
| Generation speed | Medium | High |
| Dependencies | ext-gd | None |
For most projects, we choose endroid/qr-code because of its flexibility and branding capabilities.
What to encode in the QR code
Possible contents of the QR:
- Product card URL — universal option for site transition
- UTM link — with source tags for offline/online conversion analytics
- SKU — for internal warehouse use, scanned by terminal
- Link to manual or certificate — for documentation part
Important: the URL must be short, otherwise the QR becomes dense and harder to read with cheap scanners. For long URLs, use your own redirector: https://shop.ru/go/A123/ → redirect → actual URL. Using short links reduces QR density by 30%.
How generation is implemented in Bitrix
Library installation:
composer require endroid/qr-code
# or
composer require chillerlan/php-qrcode
Basic generator class with caching:
namespace Custom\Catalog;
use Endroid\QrCode\Builder\Builder;
use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\ErrorCorrectionLevel;
use Endroid\QrCode\Writer\PngWriter;
class ProductQrGenerator {
private string $uploadDir;
public function __construct() {
$this->uploadDir = $_SERVER['DOCUMENT_ROOT'] . '/upload/qr/';
if (!is_dir($this->uploadDir)) mkdir($this->uploadDir, 0755, true);
}
public function generateForProduct(int $productId, string $url): string {
$fileName = 'product-' . $productId . '.png';
$filePath = $this->uploadDir . $fileName;
if (file_exists($filePath)) return '/upload/qr/' . $fileName;
$result = Builder::create()
->writer(new PngWriter())
->data($url)
->encoding(new Encoding('UTF-8'))
->errorCorrectionLevel(ErrorCorrectionLevel::High)
->size(400)->margin(10)
->build();
$result->saveToFile($filePath);
return '/upload/qr/' . $fileName;
}
public function generateBatch(array $productIds): void {
foreach ($productIds as $id) {
$element = \CIBlockElement::GetByID($id)->GetNextElement();
if (!$element) continue;
$fields = $element->GetFields();
$url = 'https://' . SITE_SERVER_NAME . $fields['DETAIL_PAGE_URL'];
$this->generateForProduct($id, $url);
}
}
}
Automatic generation upon product addition via OnAfterIBlockElementAdd event handler, as described in 1C-Bitrix documentation:
AddEventHandler('iblock', 'OnAfterIBlockElementAdd', function(&$fields) {
if ($fields['IBLOCK_ID'] != CATALOG_IBLOCK_ID) return;
$generator = new \Custom\Catalog\ProductQrGenerator();
$url = 'https://' . SITE_SERVER_NAME . '/catalog/item/' . $fields['CODE'] . '/';
$generator->generateForProduct($fields['ID'], $url);
});
Outputting QR code in the product card template:
<?php if (!empty($arResult['PROPERTIES']['QR_CODE_URL']['VALUE'])): ?>
<div class="product-qr">
<img src="<?= $arResult['PROPERTIES']['QR_CODE_URL']['VALUE'] ?>"
alt="Product QR code" width="120" height="120">
<a href="<?= $arResult['PROPERTIES']['QR_CODE_URL']['VALUE'] ?>"
download="qr-<?= $arResult['ID'] ?>.png">Download QR</a>
</div>
<?php endif; ?>
Why caching QR codes is important
Generating each QR code is an expensive operation. When bulk exporting labels (1000+ products), the server may not cope without caching. In our class, file existence is checked before regeneration. This reduces load by 90% on repeated runs. Batch generation of 500 products takes about 2 minutes with caching.
How we speed up mass generation
For batch processing of 1000+ products in one run, we use agents: split the ID array into portions of 50 and set an agent with a 10-second interval. This avoids timeouts and memory overruns. The entire catalog is processed in a few minutes.What is included in the work
Deliverables include:
- Analysis of the current catalog and QR usage scenarios
- Selection and connection of the library via Composer
- Implementation of a generator with caching and batch processing
- Setting up automatic generation upon adding/updating products
- Integration with label export (PNG, SVG formats)
- Creating short redirects (optional)
- Documentation and staff training
- Full source code and deployment guide
- 12-month warranty and support
The work is covered by a 12-month warranty.
Timelines
| Scope of work | Timeframe |
|---|---|
| Basic QR generation + saving + output | from 1 day |
| Batch generation + event automation | +1 day |
| QR with logo + redirector | +2 days |
| Full integration with warehouse and 1C | from 3 days |
Typical mistakes in QR code generation and their prevention
Two common problems: unreadable code due to data overflow and file duplication upon regeneration. To avoid the first, use error correction levels of at least M, and for dense data — H. The second is solved by caching by product ID, as shown in the code above. Error correction level H ensures 99.5% readability under moderate damage.
Configured once, generation works without manager intervention — it's automation that only results are noticed. Order QR generation setup and simplify warehouse work. Get a consultation and a detailed cost estimate for your project. Our team has experience with over 50 projects integrating external services.







