🤑 Black Friday Sale: 30% OFF for all plans. Coupon: BFD2022
Days
Hours
Minutes
Seconds
GET FREE VERSION GET THE PRO VERSION

Shortcodes

Use built-in plugin shortcodes to place the labels at any desired place.

In this article

Overview

Advanced Woo Labels come with some built-in shortcodes. They can be useful to customize labels positions ( if default labels positions are not enough for you ) or just place some labels outside product loops.

If you need a more complex guide on how to customize labels positions via shortcodes or php functions please read How-to customize labels positions article.

[awl_get_product_labels] shortcode

Note: use this shortcode only inside the product loop.

Shortcode to display current product labels. Can be used to customize product labels positions.

Usage:

[awl_get_product_labels position="all"]

position - choose with what position value label must be displayed. Available values: all, on_image, before_title.

If you want to use this shortcode inside php file of your theme - wrap it with do_shortcode function:

<?php do_shortcode('[awl_get_product_labels position="all"]'); ?>

[awl_get_label_by_id] shortcode

Note: this shortcode can be used inside and outside the product loop.

Use this shortcode to display any of your created labels by specifying this label ID.

Usage:

[awl_get_product_labels id="123"]

id - ID of the label that you want to display. Required.

If you want to use this shortcode inside php file of your theme - wrap it with do_shortcode function:

<?php do_shortcode('[awl_get_product_labels id="123"]'); ?>

Disabling default labels displaying

If you decide to use awl_get_product_labels shortcode to customize labels position then you can find an issue with duplicated labels inside one product. This problem appears because by default plugin use some WooCommerce hooks to display the labels. And when you are using manual labels placement via shortcodes this doesn't cancel labels placement via hooks.

Solution here is to cancel automatic label displaying via hooks and show them only via shortcodes.

To do that just open the plugin settings page and find Labels display hooks option. Set it to Disable value to fully disable all labels display hooks.

Labels display hooks option

Labels display hooks option