View Categories

Free Shipping Shortcodes and Widget in WooCommerce

The Free Shipping Bar: Amount Left for Free Shipping for WooCommerce can show the amount left for free shipping anywhere on your store using a shortcode, a widget, or a PHP function. This reference lists the real shortcodes the plugin registers and how to use them.

All three shortcodes below ship in the free version.

[alg_wc_left_to_free_shipping] #

Outputs the amount left for free shipping message. This is the main shortcode. Place it on any page, in a text widget, or inside another shortcode.

Attribute Default Description
content (empty, falls back to the default message) The message text. Accepts HTML and the plugin placeholders such as %amount_left_for_free_shipping%.
template {content} Wrapper markup around the content. Use {content} where the message should appear.
multiply_by 1 Multiplies the calculated amounts, for example to show a rounded or per-unit figure.
min_free_shipping_amount 0 Override the free shipping threshold. When 0, the plugin works it out automatically.
free_delivery_text false Text shown once free shipping is reached. When false, the General “Free shipping reached” message is used.
min_cart_amount the General “By cart amount” value Hide the message until the cart total is above this value.

Example:

[alg_wc_left_to_free_shipping content="%amount_left_for_free_shipping% left for free shipping"]

To show a progress bar inside the message, enable it first under the Progress Bar section, then add the %progress_bar% placeholder to the content. There is no progress_bar shortcode attribute.

[alg_wc_left_to_free_shipping_translate] #

Shows different text depending on the active language (works with WPML and Polylang through the ICL_LANGUAGE_CODE constant).

Attribute Description
lang One or more language codes (comma separated) the content applies to.
not_lang Language codes the content should not apply to.
lang_text Text shown when the language matches lang (attribute form).
not_lang_text Text shown otherwise (attribute form).

Attribute form:

[alg_wc_left_to_free_shipping_translate lang="de" lang_text="%amount_left_for_free_shipping% fur kostenlosen Versand" not_lang_text="%amount_left_for_free_shipping% left for free shipping"]

Wrapped form (put the shortcode around each language block):

[alg_wc_left_to_free_shipping_translate lang="de"]%amount_left_for_free_shipping% fur kostenlosen Versand[/alg_wc_left_to_free_shipping_translate]

Note: [alg_get_left_to_free_shipping] still works as a deprecated alias of the main shortcode. Use [alg_wc_left_to_free_shipping] in new content.

Widget and PHP function #

The plugin also registers an Amount Left for Free Shipping widget (Appearance > Widgets), with a Title and a Content field that accepts the same placeholders. Developers can output the message directly in a template:

echo alg_wc_get_left_to_free_shipping( array( 'content' => '%amount_left_for_free_shipping% left for free shipping' ) );

Placeholders #

The message content accepts these placeholders: %amount_left_for_free_shipping%, %free_shipping_min_amount%, %current_cart_total%, their raw (unformatted) variants %amount_left_for_free_shipping_raw%, %free_shipping_min_amount_raw%, %current_cart_total_raw%, and %progress_bar%.

Get more control #

The shortcodes and widget are free. Amount Left for Free Shipping Pro adds AJAX updates, per-category and per-user-role hiding, and extra display sections. See what Pro unlocks.

 

Free Shipping Bar: Amount Left for Free Shipping for WooCommerce