Shortcodes
The plugin provides shortcodes for custom placement of various elements on your website.
Shortcodes Overview
Section titled “Shortcodes Overview”| Shortcode | Description | Module |
|---|---|---|
[wpify_discounts_savings_summary] | Savings summary | Discount Rules |
[wpify_progress_upsell_bar] | Progress upsell bar | Upsell Bar |
[wpify_discount_selection] | Gift product selection | Discount Rules |
[wpify_discount_info_block] | Info block with discount information | Discount Rules |
Savings Summary
Section titled “Savings Summary”[wpify_discounts_savings_summary]Displays a complete savings summary block including the names of applied discounts and the total amount saved.
Parameters
Section titled “Parameters”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
Example Output
Section titled “Example Output”<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 templateecho do_shortcode( '[wpify_discounts_savings_summary]' );
// In a page builder or widget[wpify_discounts_savings_summary]AJAX Support
Section titled “AJAX Support”The shortcode automatically supports AJAX updates when the cart changes thanks to the wpify-woo-savings-summary-fragment CSS class.
Progress Upsell Bar
Section titled “Progress Upsell Bar”[wpify_progress_upsell_bar][wpify_progress_upsell_bar id="0"]Displays progress bar(s) motivating customers to increase their order.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
id | int | all | Index of a specific bar (0 = first, 1 = second, etc.) |
Examples
Section titled “Examples”// 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
Gift Product Selection
Section titled “Gift Product Selection”[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.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
rule_id | int | all | ID of a specific rule |
position | string | custom | Position for CSS class |
Examples
Section titled “Examples”// Display selection from all active rules[wpify_discount_selection]
// Display selection for a specific rule only[wpify_discount_selection rule_id="456"]When It Is Displayed
Section titled “When It Is Displayed”The shortcode displays content only if:
- There is an active rule of type Free Gift or BOGO with Manual Select mode
- All rule conditions are met
- The customer has not yet selected a product (or can select more)
AJAX Support
Section titled “AJAX Support”The selection block is automatically updated when the cart changes.
Info Block (Discount Information)
Section titled “Info Block (Discount Information)”[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.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
product_id | int | current | Product ID for which to display discounts |
Examples
Section titled “Examples”// 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"]' ); ?>When It Is Displayed
Section titled “When It Is Displayed”The shortcode displays content only if:
- A valid product exists (from the parameter or current product page)
- Active discount rules exist for the product
- The rules have a message configured for display
- Without the
product_idparameter, it only works on a product page or in a product loop - With the
product_idparameter, it works on any page - If the product has no active discount rules, the shortcode renders nothing
Where to Use Shortcodes
Section titled “Where to Use Shortcodes”Page Builders
Section titled “Page Builders”Most page builders (Elementor, Divi, Beaver Builder, WPBakery) support shortcodes directly:
- Add a “Shortcode” or “Text” block
- Paste the shortcode
- Save the page
Widgets
Section titled “Widgets”In classic widgets or block widgets:
- Add a “Text” or “Shortcode” widget
- Paste the shortcode
Theme Templates
Section titled “Theme Templates”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"]' );} );Frequently Asked Questions
Section titled “Frequently Asked Questions”The shortcode displays nothing
Check:
- Is the corresponding module activated?
- Are the rule conditions met?
- Is there a product in the cart (for savings summary)?
- 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)