All Collections
Purchases App
WooCommerce Raffle Tickets Setup
WooCommerce Raffle Tickets Setup

Learn how to setup the WooCommerce Purchases promotion with Raffle Tickets.

Giancarlo Massaro avatar
Written by Giancarlo Massaro
Updated over a week ago

Our purchases app allows you to install our widget on your order confirmation page and within user accounts, allowing users to see raffle ticket numbers after their purchase.

Already have your promotion setup and need to install it? Skip to Step 9.


  • You must be using WooCommerce.

  • Your products and variants must have unique SKUs. If you do not have SKUs, especially on your variants, you must add a unique SKU to each variant in order for us to properly generate raffle tickets.

Step 1.

Create a new promotion in ViralSweep and choose Purchases > WooCommerce.

Step 2.

If your store is connected, you will see it at the top. If it is not, please connect it.

To connect your store, login to WooCommerce.

To obtain your store URL, go to:

  • Wordpress Settings > General > Site Address (URL)

To obtain your Consumer Key and Secret Key go to:

  • WooCommerce Settings > Advanced

  • Click the REST API link and click Add Key.

  • Type in ViralSweep for the description. Choose your user, then permissions should be set to Read/Write. Click Generate API Key.

  • A consumer key and secret key will be generated. Copy both of them and paste them into ViralSweep to connect your store.

Once your store is connected, it will show up like this in ViralSweep:

Step 3.

Once connected, click Update Products and choose Import Products and All Variants.

All of your products and variants will now be pulled in and will appear on the right side.

Step 4.

Choose the products/variants that apply for this particular raffle by selecting them. If you are running raffles for multiple different items at once, our system will be able to assign raffle tickets to each of the items a user purchases.

Step 5.

On the right hand side of each item that qualifies, you will see a ticket icon, click on it. You need to indicate how many raffle tickets a user should receive for purchasing this product or variant. To avoid confusion, we typically recommend you name your variants or SKUs in WooCommerce based on the number of raffle tickets a user would receive.

Step 6.

  • Insert a title for your promotion.

  • Choose start and end dates.

  • Indicate how many winners.

  • Enable Raffle Tickets.

  • Input your Store URL.

Step 7.

Within the entries section, set it to award 0 entries for every $1 spent since we are awarding raffle tickets instead of entries for each dollar spent.

The non-qualifying order section would only appear if a user purchases something that did not qualify for the raffle. Our widget would just let them know on the order completion screen that their order did not qualify for the promotion.

Step 8.

  • Upload any images you want appearing on the widget that users see after their purchase.

  • Insert your official rules.

  • Decide if you want to geo-target the promotion based on country the order originates from.

  • In the design section you can change the styles on our widget.

  • You can setup email notifications to send people their ticket numbers when they make a purchase.

  • When you're all set, save the promotion by clicking the green Done button.

Step 9.

We offer free installation to your store, so if you need help with installation, please contact us and invite [email protected] with editor access to your store.

To install the promotion on your store, go to the Install tab in your ViralSweep dashboard and click Install Widget. Copy the code under 1. Install to Checkout.

Step 10.

Login to Wordpress and go to:

Tools > Plugin File Editor

In the top right under Select plugin to edit, choose WooCommerce and click Select.

Step 11.

In the file list on the right side find:

templates > checkout > thankyou.php

Step 12.

You may need to play around with pasting our code into different sections depending upon where on the order completion screen you want the widget appearing. For us, we think it is best to install it below the "Thank you. Your order has been received message".

Paste our code directly below this section, as shown in the screenshot below.

Step 13.

Go back to ViralSweep, go to the Install tab and copy the code under Step 2: Install to Theme.

Step 14.

Login to Wordpress and go to:

Tools > Theme File Editor

Select the theme to edit, then click on:

Parts > Footer.html

Paste in the code at the top of the file and save it.

Step 15.

If your store has user accounts and you want people to see their entries when they login to their account, continue on. Otherwise, skip to Step 17.

In your ViralSweep dashboard copy the code under Step 3: Install to Account Page.

Step 16.

Login to Wordpress and go to:

Tools > Plugin File Editor

In the top right under Select plugin to edit, choose WooCommerce and click Select.

In the file list on the right side find:

templates > myaccount > dashboard.php

In the dashboard.php file, find the section that has the "Hello" message. Paste the code directly below this section, as shown in the screenshot below.

Step 17.

You're done! Make a purchase on your store and you'll see the widget appear on your order confirmation page, and it will display the raffle ticket numbers you've earned for making that purchase. If you installed our code to user accounts, you can also login to the user account you purchased with to see your raffle ticket numbers there too.

Widget example embedded in the store checkout:

Legal Disclaimer

ViralSweep provides this feature to allow you to run purchase based sweepstakes and raffles on your store. However, most states and countries have variations in their laws and regulations regarding purchases when it comes to sweepstakes and raffles. ViralSweep assumes no responsibility for whether you are in compliance with the law. You understand that it is your responsibility to ensure that your official rules comply with the rules and regulations of your locality, including offering a free alternate method of entry where applicable.

If you are interested in having ViralSweep handle legal compliance for your promotion within the United States and Canada, please contact us.

We're here to help

If you have any further questions, please start a Chat. Just "Click" on the chat icon in the lower right corner to talk with our support team.

Did this answer your question?