View Categories

URL Coupons: Shortcodes Guide

Coupons & Add to Cart by URL Links for WooCommerce registers two shortcodes. One prints WooCommerce notices on pages that would not otherwise show them, and one shows or hides content by language for WPML and Polylang sites. This guide covers both, with the exact tags and attributes as they exist in the plugin.

These are the only two shortcodes the plugin provides. Applying a coupon itself is done through the coupon URL (for example ?alg_apply_coupon=CODE), not through a shortcode.


[alg_wc_url_coupons_print_notices] #

Availability: Pro.

What it does: prints the queued WooCommerce notices at the point where you place it. This is useful when a coupon is applied on a page (such as a custom landing page) where WooCommerce notices are not normally displayed, so the “Coupon code applied successfully” style message would otherwise be missed.

Parameters: none.

Example:

[alg_wc_url_coupons_print_notices]

Note: this shortcode prints all available WooCommerce notices on that request, not only coupon notices from this plugin.


[alg_wc_url_coupons_translate] #

Availability: Free.

What it does: shows or hides content depending on the active site language, for stores using WPML or Polylang. Use it to write coupon messages that differ per language.

Attributes:

Attribute What it does
lang Comma-separated language codes to match, for example EN,DE.
not_lang Comma-separated language codes to exclude.
lang_text Text shown to the lang languages (attribute form).
not_lang_text Fallback text for all other languages (attribute form).

Example, attribute form:

[alg_wc_url_coupons_translate lang="EN,DE" lang_text="Discount applied!" not_lang_text="Reduction appliquee !"]

Example, wrapping form:

[alg_wc_url_coupons_translate lang="EN,DE"]Discount applied![/alg_wc_url_coupons_translate]
[alg_wc_url_coupons_translate not_lang="EN,DE"]Reduction appliquee ![/alg_wc_url_coupons_translate]

Language codes are matched case-insensitively. For a full walkthrough, see the guide on translating URL coupon text with WPML and Polylang.


Get more from URL Coupons #

The [alg_wc_url_coupons_translate] shortcode is free. Coupons & Add to Cart by URL Links for WooCommerce Pro adds custom per-coupon notices, per-coupon redirects, add-to-cart coupons, and the [alg_wc_url_coupons_print_notices] shortcode. See what Pro unlocks.

 

Coupons & Add to Cart by URL for WooCommerce