Skip to main content

WooCommerce Purchase Promotions Setup

Written by Aldin Rey
Updated today

Learn how to set up a WooCommerce Purchases promotion in ViralSweep and install the widget on your store.

Already set up your promotion? Skip to Step 10 for installation.


Requirements

Before you begin, make sure:

  • You’re using WooCommerce

  • All products and variants have unique SKUs


Step 1: Create a promotion

In ViralSweep:

  • Create a new promotion

  • Select Purchases → WooCommerce


Step 2: Connect your store

If your store is already connected, it will appear at the top. Otherwise:

Get your store URL

  • Go to WordPress → Settings → General

  • Copy the Site Address (URL)

Generate API keys

  • Go to WooCommerce → Settings → Advanced → REST API

  • Click Add Key

Enter:

  • Description: ViralSweep

  • Permissions: Read/Write

Click Generate API Key, then copy:

  • Consumer Key

  • Consumer Secret

Paste these into ViralSweep to connect your store.


Step 3: Choose qualifying products

Decide which purchases should earn entries:

  • All products (default), or

  • Specific products only

If selecting specific products:

  1. Click Update Products

  2. Select "Yes Proceed"

  3. Choose qualifying items

💡 If a customer purchases a non-selected product, they won’t earn entries.


Step 4: Configure promotion details

  • Add a promotion title

  • Set start and end dates

  • Choose the number of winners

  • Set Raffle Tickets Enabled → No (for non-profits only)

  • Enter your Store URL


Step 5: Set entry rules

By default, customers earn 1 entry per $1 spent, but you can customize this.

You can also:

  • Change currency (top right)

  • Schedule bonus entry periods

If enabled, the widget will notify users when an order does not qualify.


Step 6: Add order bonuses (optional)

Reward customers with bonus entries for orders over a certain value.

This is useful for increasing average order value.


Step 7: Add post-purchase actions (optional)

Let customers earn additional entries through actions like:

  • Social follows

  • Sharing content

Configure these in the Social Actions section.


Step 8: Customize the widget

  • Upload images

  • Add official rules

  • Adjust styling in the Design section

  • Enable email notifications (optional)

Click Done to save your promotion.


Step 9: Install the widget (Checkout page)

We offer free installation. If you'd like help, contact support and invite [email protected] with editor access.

To install manually:

  • Go to the Install tab in ViralSweep

  • Copy code under Step 1: Install to Checkout


Step 10: Add code to the order confirmation page

In WordPress:

  • Go to Tools → Plugin File Editor

  • Select WooCommerce

Open:

templates > checkout > thankyou.php

Paste the widget code below:

“Thank you. Your order has been received”

💡 Placement may vary depending on your theme.


Step 11: Add global widget script

In ViralSweep:

  • Copy code under Step 2: Install to Theme

In WordPress:

  • Go to Tools → Theme File Editor

  • Open:

Parts > Footer.html

Paste the code at the top and save.


Step 12: (Optional) Add to customer account page

If your store supports accounts:

  • Copy code from Step 3: Install to Account Page

In WordPress:

  • Go to Tools → Plugin File Editor

  • Select WooCommerce

Open:

templates > myaccount > dashboard.php

Paste the code below the “Hello” message.


Step 13: Test your setup

  1. Place a test order

  2. Confirm the widget appears on the order confirmation page

  3. Log into the customer account (if enabled) to verify entries display correctly


Once setup is complete, the widget should appear on your WooCommerce pages. If it doesn’t, the issue is usually related to customer data, promotion settings, or theme configuration—see the troubleshooting steps below.


🔍 Widget not showing? Here’s what to check

If your widget isn’t appearing, it’s usually due to conditions not being met rather than an installation issue.

Logged-in email must match the order email

The widget only appears if:

  • The logged-in WooCommerce account uses the same email as the order

If they don’t match:

  • The widget will not display

This often happens during testing or when customers use different emails at checkout.


The customer must have at least one entry

On the customer account page, the widget only shows if the user already has at least one valid entry.

If no entries exist:

  • The widget will not appear (this is expected)


The promotion must be active

If your promotion:

  • Has not started yet, or

  • Has already ended

The widget may not display.


Code is visible, but no widget appears

If you can see the ViralSweep script in page source:

  • Installation is likely correct

  • The issue is usually missing data or conditions

Common causes:

  • No entries

  • Email mismatch

  • Promotion inactive

  • Theme/template issues


🧪 How to test your setup correctly

To avoid false negatives during testing:

  1. Place a real test order

  2. Use an email tied to a registered account

  3. Log in with that same account

  4. Confirm:

    • The order exists in WooCommerce

    • The promotion is active

    • The purchase generated an entry

If testing the account page:

  • You must be logged in as the same customer who placed the order


🎨 Using custom themes (Divi, etc.)

Some themes override WooCommerce templates like thankyou.php.


This can affect widget placement.


If the widget isn’t displaying:

  • Check whether your theme overrides WooCommerce templates

  • Ensure the widget code is placed where order data is available

Important:

The widget must be inside the section where the order is defined (typically inside the if ($order) block).

If placed outside of this:

  • The widget may not render, even if the code is present


✅ Quick checklist

If your widget isn’t showing:

  • Promotion is active

  • Purchase created an entry

  • Logged-in email matches order email

  • Customer has at least one entry

  • Theme isn’t overriding placement incorrectly

Did this answer your question?