Smart Offers Shortcode Reference

Smart Offers has few custom shortcodes that you can use anywhere in the offer content. For more understanding on WordPress shortcodes you can check out the WordPress Codex.

1. Shortcode to show an offer

In addition to default page option i.e Home, Cart, Checkout, Before Order Complete, Order Received/Thank you, My Account, you can show offer on any other page with the use of shortcode [so_show_offers]. You can embed this shortcode anywhere in posts, pages, products and even widgets.

Arguments passed to the shortcode:

'offer_ids' => '102, 148, 259',
'display_as' => 'inline' or 'popup'

The “offer_ids” argument will show one of the offer from the ids mentioned in this argument. If no value is passed, then Smart Offers will fetch all offers having option “Anywhere shortcode is added” ticked under “Show offer on page” and will show one of the offer satisfying offer rules and Smart Offers settings.

The “display_as” argument determines how to display the offer. The value that can be passed to the argument can be “inline” or “popup”. If no value is passed then value would be taken from the option saved in “Show offer as” of the offer that will be shown.

Example usage,

[so_show_offers]
[so_show_offers display_as='inline' offer_ids='102']
[so_show_offers display_as='popup' offer_ids='148,259']

You can find an offer’s shortcode as shown in the following screenshot:

Shortcode Reference

Recommended read: FAQ 11 & 12
Related blog: Shortcode to show Smart Offers on any page or post

2. Shortcode to allow choosing variation from offer

If you offer a variable product in the offer, than shortcode [so_product_variants] will allow you to choose the variation option for that variable product. This will let your customer choose which variation they want.

Usage,

[so_product_variants]

Related blog: Smart Offers, just the way you want it!

3. Shortcode to show offered product image

Shortcode [so_product_image] will show the image of the offered product in the offer content.

Arguments passed to the shortcode:

'image' => 'yes' or 'no'

Usage,

[so_product_image image='yes']

Note: If you add shortcode [so_product_image] and the offered product doesn’t have image, then it will show product thumbnail image in the offer content.

4. Shortcode to show offered product’s price

Shortcode [so_price] will show the original price & the offered product’s price in the offer content if the offered product is a Simple product.

This shortcode doesn’t need any arguments and it will generate a result like this: Offer Price: Original Price – New Price

Price Shortcode Reference

Usage,

[so_price]

Note: Shortcode [so_price] is to be only used if your offered product is a Simple Product. If the offered product is Variable product, then price shortcode is by default included and you do not have to write it.

5. Shortcode to show quantity box

By default, only one quantity of offered product is added to cart when an offer is accepted. Shortcode [so_quantity] will allow you to offer more than one quantity of the offered product. If you add shortcode [so_quantity] with no parameter, the quantity box won’t appear in the offer.

To show quantity in the offer, add [so_quantity allow_change=true], this will show quantity box in the offer.

Arguments passed to the shortcode:

'value' => 2,
'allow_change' => true or false,
'min' => 1,
'max' => 1,

The “value” argument defines what should be the quantity value. If “value” parameter is not passed then it is considered to be 1. If you want to offer your customer two fixed quantity of an offered product then add [so_quantity value=2]. This will not show quantity in the offer and quantity of offered product that will added to cart after accepting the offer will be 2.

The “allow_change” defines whether you want to allow your customer to change the quantity or not and indirectly determining whether to show quantity in the offer or not. Default value is false. If you want to allow your customer to change the quantity then pass value as true.

The “min” argument defines what should be the minimum quantity that your customer can select. Default value for “min” parameter is 1.

The “max” argument defines what should be the maximum quantity that your customer can select.

Example usage,

[so_quantity value=3]
[so_quantity allow_change=true min=2 max=5]

Note: You should either use value OR allow_change, min, max as shortcode params because specifiying value means you want to offer fixed quantity of offered product whereas specifiying allow_change means you want customers to pick quantity of offered product from the offer.

6. Shortcode to show offered product’s name

Shortcode [so_product_name] will show offered product’s name in the offer content.

Usage,

[so_product_name]

7. Shortcode to show short description of offered product’s

Shortcode [so_product_short_description] will show short description of offered product’s in the offer content.

Usage,

[so_product_short_description]

8. Shortcode to generate accept link

Shortcode [so_acceptlink offer_id=23] will generate an accept link for the offer.
This shortcode is automatically added in the offer content.

Usage,

[so_acceptlink offer_id=23]

9. Shortcode to Generate skip link

Shortcode [so_skiplink offer_id=23] will generate an skip link for the offer.
This shortcode is automatically added in the offer content.

Usage,

[so_skiplink offer_id=23]
« Back to Smart Offers