Skip to content

Shortcodes

The plugin provides shortcodes for custom placement of various elements on your website.

ShortcodeDescriptionModule
[wpify_discounts_savings_summary]Savings summaryDiscount Rules
[wpify_progress_upsell_bar]Progress upsell barUpsell Bar
[wpify_discount_selection]Gift product selectionDiscount Rules
[wpify_discount_info_block]Info block with discount informationDiscount Rules

[wpify_discounts_savings_summary]

Displays a complete savings summary block including the names of applied discounts and the total amount saved.

The shortcode has no parameters. The content is controlled by settings in General Settings:

  • Show discount names - enables/disables the list of rule names
  • Show saved amount - enables/disables the total amount
<div class="wpify-woo-savings-summary">
<div class="wpify-woo-savings-summary__labels">
Applied discounts: Winter Sale, VIP Discount
</div>
<div class="wpify-woo-savings-summary__total">
You saved: 350 CZK
</div>
</div>
// In a template
echo do_shortcode( '[wpify_discounts_savings_summary]' );
// In a page builder or widget
[wpify_discounts_savings_summary]

The shortcode automatically supports AJAX updates when the cart changes thanks to the wpify-woo-savings-summary-fragment CSS class.


[wpify_progress_upsell_bar]
[wpify_progress_upsell_bar id="0"]

Displays progress bar(s) motivating customers to increase their order.

ParameterTypeDefaultDescription
idintallIndex of a specific bar (0 = first, 1 = second, etc.)
// Display all configured progress bars
[wpify_progress_upsell_bar]
// Display only the first bar
[wpify_progress_upsell_bar id="0"]
// Display only the second bar
[wpify_progress_upsell_bar id="1"]
  • Indexes start from 0
  • If a bar with the given index does not exist, nothing is displayed
  • Conditional display (date, role) is respected for shortcodes as well

[wpify_discount_selection]
[wpify_discount_selection rule_id="123"]

Displays a block for selecting products from rules of type Free Gift or Buy X Get Y with Manual Select mode.

ParameterTypeDefaultDescription
rule_idintallID of a specific rule
positionstringcustomPosition for CSS class
// Display selection from all active rules
[wpify_discount_selection]
// Display selection for a specific rule only
[wpify_discount_selection rule_id="456"]

The shortcode displays content only if:

  1. There is an active rule of type Free Gift or BOGO with Manual Select mode
  2. All rule conditions are met
  3. The customer has not yet selected a product (or can select more)

The selection block is automatically updated when the cart changes.


[wpify_discount_info_block]
[wpify_discount_info_block product_id="123"]

Displays an info block with discount information for a product. This shortcode allows you to display discount information anywhere on your website, not just on the product page.

ParameterTypeDefaultDescription
product_idintcurrentProduct ID for which to display discounts
// On a product page (uses the current product)
[wpify_discount_info_block]
// For a specific product
[wpify_discount_info_block product_id="456"]
// In a PHP template
<?php echo do_shortcode( '[wpify_discount_info_block product_id="123"]' ); ?>

The shortcode displays content only if:

  1. A valid product exists (from the parameter or current product page)
  2. Active discount rules exist for the product
  3. The rules have a message configured for display
  • Without the product_id parameter, it only works on a product page or in a product loop
  • With the product_id parameter, it works on any page
  • If the product has no active discount rules, the shortcode renders nothing

Most page builders (Elementor, Divi, Beaver Builder, WPBakery) support shortcodes directly:

  1. Add a “Shortcode” or “Text” block
  2. Paste the shortcode
  3. Save the page

In classic widgets or block widgets:

  1. Add a “Text” or “Shortcode” widget
  2. Paste the shortcode

In PHP templates use:

<?php echo do_shortcode( '[wpify_discounts_savings_summary]' ); ?>

If you want to display a shortcode on a specific WooCommerce hook:

add_action( 'woocommerce_before_cart', function() {
echo do_shortcode( '[wpify_progress_upsell_bar id="0"]' );
} );

The shortcode displays nothing

Check:

  1. Is the corresponding module activated?
  2. Are the rule conditions met?
  3. Is there a product in the cart (for savings summary)?
  4. Does an active rule with the given ID exist?
Can I use multiple shortcodes on a single page?

Yes. You can use any number of shortcodes. Each one renders independently.

Do shortcodes work with caching?

Shortcodes generate dynamic content dependent on the cart. For proper functionality:

  • Exclude pages with shortcodes from full-page cache
  • Or use AJAX fragments (automatically supported)