Posted on

Shortcode to show Smart Offers on any page or post

Have you ever felt a need to show a Smart Offer on a specific post or page – other than default page options listed in Smart Offers configuration? Or probably your theme is not fully WooCommerce compatible and it does not show Smart Offers on designated pages?

Smart Offers’ version 1.7 onward allows you to show an offer on any page or post with a simple WordPress shortcode.

This means you can now configure offers and show them anywhere on your site. It’s a powerful feature, so here’s an explanation on how to use it.

The Smart Offer Embed Shortcode

Use the shortcode to embed an offer on any page or post.

  • display_as
  • offer_ids

display_as Parameter

The “display_as” parameter tells how to display the offer. The value here can be either “inline” or “popup”.

BTW, if you don’t provide any value for this parameter, Smart Offers will use your default choice from offer settings in “Which page/pages to show offer on -> Show offer as”.

Examples

[so_show_offers display_as='popup']
[so_show_offers display_as='inline']

offer_ids Parameter

The “offer_ids” parameter will show one of the offers from the list of offer IDs passed. If no value is passed, then Smart Offers will search through all offers with option “Any other page where shortcode is added” ticked under “Which page/pages to show offer on -> Show offer on” and show one offer that meets all the rules and settings.

Examples

[so_show_offers offer_ids='123']
[so_show_offers offer_ids='123, 124']

Setting Up Offers and Embedding the Short Code

Imagine you want to show an upsell for a product – but on the product’s page itself after it is added to cart. The first thing you want to do is create a Smart Offer, with offer rule saying ‘Cart contains product‘ and selecting the main product in question.

The most important step is to tick the “Any other page where shortcode is added” option under where this offer should be shown.

Now, add shortcode in the product description – wherever you want – may be at the top… And save.

Now, when your customer adds your main product to cart, and is redirected back to the product page with success message, Smart Offers will show them the upsell offer.

You can even show the upsell on any other related product’s description.. For example, “Since you also have the T-shirt in your cart, you can buy this Cap for 20% off. Click here to add it to cart”. (And you embed the offer shortcode on “Cap” page…)

You get full flexibility! Embed the short code anywhere. Configure the offer with rules of your choice!

Resolving Theme Compatibility issues with WooCommerce Smart Offers

Offer not showing on Cart/Checkout page?

  1. You have an offer setup to show on Cart or Checkout page but the offer isn’t showing up at all.
  2. Firstly, check whether the same offer is showing up on ‘My Account’ page by ticking the option ‘My Account‘ in ‘Show this offer on‘. If offer shows up on ‘My Account’ page, then it means that the theme you are using is not fully compatible with WooCommerce.
  3. To solve theme compatibility issues, switch to a default WordPress theme and test whether offer is showing. If default theme shows the offer, add the shortcode in cart/checkout page description before the Woocommerce shortcode. You will see offers showing up!

You can go through detailed description on Smart Offers Shortcode in documentation here.

What’d you say?

Hope you liked our shortcode addition in Smart Offers!!!

Do use this new feature and tell us how you use shortcodes by posting a comment! You can also share how you are using Smart Offers!

Need help? Got questions? Write to us here.

(Editor’s note: You can even address your Smart Offers questions to Rupali – the lead developer of the plugin, and author of this blog post!)

12 thoughts on “Shortcode to show Smart Offers on any page or post

  1. There is no example shortcode showing for me in the area marked “example” on this page, and I couldn’t find the shortcode provided anywhere in the plugin either.

  2. Thank you for pointing it out. I’ve corrected it & now it is showing.

    Actually, the example was there, but due to some error it was not visible.

    Anyway, you can also go through this link for detailed information about all shortcodes available in Smart Offers

  3. hi

    it’s possible to use the shortcode as a php code?
    like: echo do_shortcode( ‘[so_show_offers]‘ );

    1. Yes, it is possible.

      1. how would you do this and use a rule where by you only show the offer when a user registers and one when a user is a visitor.

      2. Create 2 separate offers, one having rule to show to registered user & another having rule to show to visitor. Now on the page where you want to show the offer, put shortcode with both offer ids like [so_show_offers offer_ids='123,124']

  4. I tried your demo and if you put an product on offer that has variables the Buy now and Skip buttons do not show unless you select one of the options, this is kind of silly, you should be able to see the buttons regardless, especially the skip button.

    1. Thank you for your suggestion.

      We can improve this by showing default variations, if available, then show ‘Accept’ button. Showing ‘Accept’ button should only be visible when a variation is selected. This is how it works in WooCommerce Core.

      Your point about showing ‘Skip’ button always, is logical & valid. We’ll consider this in future.

  5. I’ve been using this plugin forever, but recently wanted to use the “Any other page where shortcode is added” functionality. Silly question, but… where do you find the offer_id? I don’t see it anywhere.

    1. Hi Dave,

      If you are using Smart Offers v3.2.7+, then under Which pages to show this offer on section, you will find offer shortcode written next to select pages option. If you can’t see shortcode written even if plugin is updated, save offer once more to see the option.

      You can find the same shown on our demo site. Click here to see it and if login information is asked, enter as written here.

      Let me know if it works for you.

  6. When using the shortcode to display smart offers on any page, how do you hide the offer if the item has already been added to the shopping cart?

    1. It should hide the offer. I checked it & it seems that the functionality is not working correctly.

      I’m adding it in our to-do list. We’ll fix this future releases.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.