This reference lists the template placeholders and shortcodes provided by EAN for WooCommerce, so you can control exactly where and how each product’s EAN appears. Placeholders are used inside the plugin’s own template fields; shortcodes work anywhere WordPress runs shortcodes.
Template placeholders #
Placeholders are replaced with live values in the plugin’s template boxes, such as General > Single product page > Template, the shop, cart, and order item table templates.
| Placeholder | Replaced with | Where it works |
|---|---|---|
%ean% |
The product’s EAN value. | Single product, shop, cart, and order item table templates. |
%new_line% |
A line break. | Plain text order item table template (emails only). |
The default single product template is EAN: %ean%. You can also place shortcodes inside these template fields.
Core shortcodes (free) #
The main shortcode outputs the EAN. Attributes shown are the most common; all shortcodes share product_id, before, after, and on_empty.
| Shortcode | Outputs | Notable attributes |
|---|---|---|
[alg_wc_ean] |
The product’s EAN. | children="yes", glue |
[alg_wc_ean_is_valid] |
Whether a given EAN is valid. | ean, valid_text, invalid_text |
[alg_wc_ean_is_unique] |
Whether a given EAN is unique in the shop. | ean, unique_text, duplicate_text |
[alg_wc_ean_product_sku] |
The product SKU. | parent, max_length |
[alg_wc_ean_product_name] |
The product name or title. | type (name or title) |
[alg_wc_ean_product_price] |
The product price. | type (final, regular, sale), raw |
[alg_wc_ean_product_attr] |
A product attribute value. | attr |
[alg_wc_ean_product_meta] |
A product meta value. | key |
[alg_wc_ean_product_image] |
The product image, as an img tag or URL. |
output, size, width, height |
[alg_wc_ean_product_id], [alg_wc_ean_product_author_id] |
The product ID or its author ID. | parent, min_length |
[alg_wc_ean_product_terms] |
Product terms (categories, tags, or any taxonomy). | taxonomy, return |
[alg_wc_ean_if], [alg_wc_ean_if_product_cat], [alg_wc_ean_if_product_tag] |
Conditional output based on a comparison or category/tag. | value1, operator, value2, then, else |
Barcode shortcodes (Pro) #
Barcode output is a Pro feature. The Barcodes or 2D Barcodes section does not need to be enabled for the shortcodes themselves to render.
| Shortcode | Outputs | Notable attributes |
|---|---|---|
[alg_wc_ean_barcode] |
A 1D barcode image. | content, w, h, color, add_text, template |
[alg_wc_ean_barcode_2d] |
A 2D (QR-style) barcode image. | content, w, h, color |
[alg_wc_ean_barcode_base64], [alg_wc_ean_barcode_2d_base64] |
The barcode as a base64 data string, for PDFs and exports. | w, h, color, before |
Related #
- Shortcode guide to EAN and barcodes for worked examples.
- Developer hooks and filters reference for filter names.
Need a hand? #
Our team answers every ticket on the EAN for WooCommerce support forum.