Shortcodes for product data

Permalink Output of additional product data from German Market

Depending on your German Market settings, additional information such as tax information, delivery time or the price per unit will be displayed after the price of a product.

If you do not want this data to be displayed automatically, you can use the Advanced settings from the “Product data” menu.

Alternatively, you can use the following code snippets to prevent the output.

On the product page:

add_action( 'after_setup_theme', function() {
	remove_action( 'woocommerce_single_product_summary', array( 'WGM_Template', 'woocommerce_de_price_with_tax_hint_single' ), 7 );
});

On the shop page, archive pages, for similar products (in the loop):

add_action( 'after_setup_theme', function() {
	remove_action( 'woocommerce_after_shop_loop_item_title', array( 'WGM_Template', 'woocommerce_de_price_with_tax_hint_loop' ), 5 );
});
If you have basic developer skills, you can add the code snippet to the functions.php of your theme (preferably at the end). However, you should work with a child theme so that your changes are not overwritten every time the theme is updated.

Alternatively, you can use a plugin such as “Code Snippets” (https://de.wordpress.org/plugins/code-snippets/).

It allows you to easily add code directly from the WordPress backend, regardless of your theme (see video tutorial by Harald Frey https://wooexperte.de/code-snippets-plugin-fuer-woocommerce-nutzen-2/.) A similar extension is “Insert PHP Code Snippet” (https://de.wordpress.org/plugins/insert-php-code-snippet/).

Please note that hiding this information may not be legally permitted. If you hide the data, you may need to seek legal advice to check whether this is permitted.

However, you can now also output the hidden data via shortcode as described below.

Permalink Using the shortcodes

If you have created a template yourself to output your products or use a special page builder, you may be looking for the option of using shortcodes to output special product data from German Market.

The use of shortcodes as described here is possible from version 3.10.6 of German Market.

Please note that for variable products, some details (such as delivery time or base price) are only displayed if all variants of the variable product have the same identical value.

Permalink Tax information

To get the tax information of a product, you can use the following shortcode:

[gm_product_tax_info]

The output is then e.g:

Includes 19% VAT

If you do not want to output this shortcode on a single product page or in the loop, or if you want to output the data of a specific product, you can optionally pass the product ID of the desired product as a parameter, e.g:

[gm_product_tax_info product_id="7466"]

HTML markup is also displayed in the output, the output is in HTML format, e.g:

<div class="wgm-info woocommerce-en_price_taxrate">Includes 19% VAT</div>

If you don’t want to get the HTML markup, you can use the shortcode as follows

[gm_product_tax_info markup="no"]

Permalink Shipping information

The shipping information of a product can be output with the following shortcode:

[gm_product_shipping_info]

The output is then e.g:

plus shipping

HTML markup is also displayed in the output, e.g:

<div class="wgm-info woocommerce_en_shipping_costs">plus <a class="shipping" href="https://marketpress.de/" target="_blank">shipping</a></div>

If you don’t want to preserve the HTML markup, you can use the shortcode as follows

[gm_product_shipping_info markup="no"]

However, this will also remove the <a> tag so that there is no longer a link to the shipping page. If you want to keep this link but remove the rest of the HTML markup, you can use the shortcode as follows:

[gm_product_shipping_info markup="only_a_tags"]

The HTML output is then e.g:

including <a class="shipping" href="https://marketpress.de/" target="_blank">shipping</a>

If you do not want to output this shortcode on a single product page or in the loop, or if you want to output the data of a specific product, you can optionally pass the product ID of the desired product as a parameter, e.g:

[gm_product_shipping_info product_id="7466"]

Permalink Delivery time

The following shortcode can be used to display the delivery time of a product:

[gm_product_delivery_time]

The output is then e.g:

Delivery time: 24 hours

If you do not want to output this shortcode on a single product page or in the loop, or if you want to output the data of a specific product, you can optionally pass the product ID of the desired product as a parameter, e.g:

[gm_product_delivery_time product_id="7466"]

HTML markup is also displayed in the output, the output is in HTML format, e.g:

<div class="wgm-info shipping_en shipping_en_string delivery-time-ca-24-hours">
<small>
<span>Delivery-time: 24 hours</span>
</small>
</div>

If you don’t want to keep the HTML markup, you can use the shortcode as follows

[gm_product_delivery_time markup="no"]

If you do not want to output the “Delivery time:” string, but only the actual delivery time, you can specify the “label” parameter in the shortcode and pass an empty string, e.g. like this:

[gm_product_delivery_time markup="no" label=""]

The output is then reduced to:

24 hours

Permalink Price per unit

The base price (price per unit) can be obtained with the following shortcode:

[gm_product_ppu]

The output is then e.g:

(1,00 € / 10 kg)

If you do not want to output this shortcode on a single product page or in the loop, or if you want to output the data of a specific product, you can optionally pass the product ID of the desired product as a parameter, e.g:

[gm_product_ppu product_id="7466"]

HTML markup is also displayed in the output, the output is in HTML format, e.g:

<span class="wgm-info price-per-unit price-per-unit-loop ppu-variation-wrap">(<span class="woocommerce-Price-amount amount" ><bdi>1.00 <span class="woocommerce-Price-currencySymbol">€</span></bdi></span> / 10 kg)</span>

If you don’t want to preserve the HTML markup, you can use the shortcode as follows

[gm_product_ppu markup="no"]

Permalink GTIN

If you have activated the setting
WooCommerce -> German Market -> General -> Products -> GTIN -> Activation
you can use the following shortcode to display the GTIN of the product:

[gm_product_gtin]

If you do not want to output this shortcode on a single product page or in the loop, or if you want to output the data of a specific product, you can optionally pass the product ID of the desired product as a parameter, e.g:

[gm_product_gtin product_id="7466"]

Permalink Sale label

To display the “sale label” of a product, you can use the following shortcode:

[gm_product_sale_label]

If you do not want to output this shortcode on a single product page or in the loop, or if you want to output the data of a specific product, you can optionally pass the product ID of the desired product as a parameter, e.g:

[gm_product_sale_label product_id="7466"]

The output is then, for example

<span class="wgm-sale-label">Previously with us</span>

Permalink Requirements (digital)

The following shortcode can be used to output the “Requirements (digital)” set in the products:

[gm_product_digital_prerequisites]

If you do not want to output this shortcode on a single product page or in the loop, or if you want to output the data of a specific product, you can optionally pass the product ID of the desired product as a parameter, e.g:

[gm_product_digital_prerequisits product_id="7466"]

HTML markup is also displayed in the output, the output is in HTML format, e.g:

<div class="wgm-info wgm-product-prerequisites">2 GB free disk space</div>

If you don’t want to get the HTML markup, you can use the shortcode as follows

[gm_product_digital_prerequisites markup="no"]

Permalink Age rating

If you use the age rating of German Market, which you can find under
WooCommerce -> German Market -> General -> Products -> Age rating
the following shortcode can be used to display the required age for a product:

[gm_product_age_rating]

If you do not want to output this shortcode on a product single page or in the loop, or if you want to output the data of a specific product, you can optionally pass the product ID of the desired product as a parameter, e.g:

[gm_product_age_rating product_id="7466"]

Optionally, you can also output a prefix and a suffix, e.g. as follows:

[gm_product_age_rating prefix="Age rating: From" suffix=" years"]

This results in the following output:

Age rating: from 16 years

If you have defined a release of “0” in the product, this will also be output. You can use the optional parameter hide_if_zero to prevent output if the age rating is “0”:

[gm_product_age_rating hide_if_zero="yes"]

Permalink Non-EU Shipping Disclaimer

You can activate the “Non-EU Shipping Disclaimer” in the menu
WooCommerce -> German Market -> General -> Products
and change its wording if necessary.

The following shortcode can be used to display this note:

[gm_extra_costs_non_eu]

HTML markup is also displayed in the output, if you do not want to receive the HTML markup, but only the text, you can use the shortcode as follows:

[gm_extra_costs_non_eu markup="no"]

Permalink Shortcodes for the FIC add-on

If you use the add-on for the “Food information to consumers” (FIC), it may add product tabs to the product pages. These can be the tabs for ingredients, nutritional values and allergens. If you do not want to use these tabs, you can use the following code snippet:

add_action( 'after_setup_theme', function() {
	remove_filter( 'woocommerce_product_tabs', 'gm_fic_product_tab' );
});
If you have basic developer skills, you can add the code snippet to the functions.php of your theme (preferably at the end). However, you should work with a child theme so that your changes are not overwritten every time the theme is updated.

Alternatively, you can use a plugin such as “Code Snippets” (https://de.wordpress.org/plugins/code-snippets/).

It allows you to easily add code directly from the WordPress backend, regardless of your theme (see video tutorial by Harald Frey https://wooexperte.de/code-snippets-plugin-fuer-woocommerce-nutzen-2/.) A similar extension is “Insert PHP Code Snippet” (https://de.wordpress.org/plugins/insert-php-code-snippet/).

The data that is output in these tabs can then also be output using the shortcodes described below.

Permalink FIC - Ingredients

You can output the ingredients of the FIC add-on with the following shortcode:

[gm_product_ingredients]

If you do not want to output this shortcode on a single product page or in the loop, or if you want to output the data of a specific product, you can optionally pass the product ID of the desired product as a parameter, e.g:

[gm_product_ingredients product_id="7466"]

The heading for the ingredients is also displayed. If you want to prevent this headline from being displayed, you can use the “show_headline” parameter in the shortcode and pass it the value “no”:

[gm_product_ingredients show_headline="no"]

If no ingredients are stored in the product, the shortcode will not execute any output.

Permalink FIC - Nutritional Values

The nutritional values of the FIC add-on can be output with the following shortcode:

[gm_product_nutritional_values]

If you do not want to output this shortcode on a single product page or in the loop, or if you want to output the data of a specific product, you can optionally pass the product ID of the desired product as a parameter, e.g:

[gm_product_nutritional_values product_id="7466"]

The heading for the nutritional values is also output. If you want to prevent this headline from being displayed, you can use the “show_headline” parameter in the shortcode and pass it the value “no”:

[gm_product_nutritional_values show_headline="no"]

If no nutritional values are stored in the product, the shortcode displays nothing.

Permalink FIC - Allergens

The allergens of a product can be displayed with the following shortcode:

[gm_product_allergens]

If you do not want to output this shortcode on a single product page or in the loop, or if you want to output the data of a specific product, you can optionally pass the product ID of the desired product as a parameter, e.g:

[gm_product_allergens product_id="7466"]

The heading for the allergens is also displayed. If you want to prevent this headline from being displayed, you can use the “show_headline” parameter in the shortcode and pass it the value “no”:

[gm_product_allergens show_headline="no"]

If no allergens are configured in the product, there is no output from this shortcode.

Permalink FIC - Alcohol

The alcohol content is displayed after the price of a product on a product page or store pages depending on the following settings:

WooCommerce -> German Market -> FIC -> Alcohol content -> Show Alcohol Content in Shop
and
WooCommerce -> German Market -> LMIV -> Alcohol content -> Show Alcohol Content on Product Pages

If you have deactivated these settings and want to display the alcohol content yourself using a shortcode, you can use this shortcode:

[gm_product_alcohol]

If you do not want to output this shortcode on a single product page or in the loop, or if you want to output the data of a specific product, you can optionally pass the product ID of the desired product as a parameter, e.g:

[gm_product_alcohol product_id="7466"]

HTML markup is also displayed in the output, the output is in HTML format, e.g:

<span class="wgm-info fic-alcohol">Alk. 5,7 % vol</span>

If you don’t want to keep the HTML markup, you can use the shortcode as follows

[gm_product_alcohol markup="no"]

The output is then e.g:

Alcohol 5% vol