View Categories

Global Shortcode Attributes Reference

Every shortcode in Product XML Feeds Manager for WooCommerce accepts a shared set of global attributes that transform the value before it is written to your feed. These attributes are handled once, centrally, so they work the same way on any tag, whether it is a product tag like [alg_product_price] or a general tag like [alg_format_number].

These attributes are free. They run in the feed Template Options for each feed under WPFactory > Product XML Feeds (also reachable at WooCommerce > Settings > Product XML Feeds), wherever you place a shortcode.

Available attributes #

Attribute Default What it does
before empty Text prepended to a non-empty result. See the encoding helpers below for adding = and quotes.
after empty Text appended to a non-empty result.
find / replace empty Runs a string replace on the result: every occurrence of find becomes replace.
find_replace_sep empty A separator that lets you pass several find and replace pairs at once, for example find="a|b" replace="1|2" find_replace_sep="|".
on_empty empty A fallback value returned when the shortcode produces an empty result.
on_empty_apply_shortcodes no When yes, the on_empty fallback is itself run through the shortcode engine. Use { and } in place of square brackets inside it.
convert_currency_from empty Source currency code for conversion (for example EUR). See the currency-conversion guide.
convert_currency_to empty Target currency code. Conversion only runs when the result is numeric and both codes are set.
convert_currency_precision 2 Number of decimal places the converted amount is rounded to.
exchange_rate 0 A fixed exchange rate. When set, it is used instead of the live European Central Bank rate.
custom_function empty Runs an allow-listed PHP function on the result. The function name must be added through the alg_allowed_custom_functions filter first.
strip_tags yes Strips HTML tags from the result. Set to no to keep markup, for example in a description field.
strip_shortcodes no Set to yes to remove any leftover shortcodes with WordPress core, or yes-force to strip bracketed fragments with a regular expression.
cdata no When yes, wraps the result in a CDATA block, which keeps HTML and special characters valid inside an XML tag.
append_currency no When yes, appends the store currency code after the result, for example 19.99 USD.
on_zero / on_zero_apply_shortcodes empty / no When the result equals zero, return on_zero instead. Set on_zero_apply_shortcodes="yes" to run the fallback through the shortcode engine (use { and } for brackets).

The order attributes are applied #

Attributes run in a fixed order, so the output of one feeds the next:

  1. The shortcode produces its raw value.
  2. strip_tags, then strip_shortcodes.
  3. Currency conversion (exchange_rate if set, otherwise the live rate).
  4. find / replace.
  5. custom_function.
  6. on_zero substitution.
  7. append_currency, then optional cdata wrapping.
  8. before and after are added around the final value.

If the shortcode produced an empty value, none of the above runs and the on_empty fallback is returned instead.

Encoding equals signs and quotes in before / after #

Because a shortcode attribute cannot easily contain its own quotes or equals signs, the before and after values support three placeholders that are decoded at output time:

Placeholder Becomes
#algequal; an equals sign =
#algquotstart; an opening double quote
#algquotend; a closing double quote

Examples #

<!-- Wrap the SKU in an attribute, escaping the quotes and equals sign -->
[alg_product_sku before="<id code#algequal;#algquotstart;" after="#algquotend;>"]

<!-- Fall back to a fixed value when the field is empty -->
[alg_product_sku on_empty="N/A"]

<!-- Keep description HTML but wrap it so the XML stays valid -->
[alg_product_short_description strip_tags="no" cdata="yes"]

Get more from your feeds #

These attributes ship free with Product XML Feeds Manager for WooCommerce. Pro removes the one-feed limit and unlocks per-feed filtering and flexible update schedules. See what Pro unlocks.