1. Dokumentation /
  2. Competitions for WooCommerce

Competitions for WooCommerce

If you override default and use custom templates in your_theme/woocommerce/ you need to make sure that templates are updated with those in plugin_dir/competitions-for-woocommerce/templates/ – otherwise new features might not show up on the site. Backing up your WP, WooCommerce and its database is something you should consider when updating and modifying this plugin – just in case.

Requirements

↑ Nach oben
  • WordPress
  • WooCommerce

Installation

↑ Nach oben
  1. Download the .zip file from your WooCommerce account.
  2. Go toWordPress Admin > Plugins > Add New and Upload Plugin.
  3. Choose File with the file you downloaded in step 1.
  4. Install Now and Activate Plugin.

Configuration

↑ Nach oben

After activating Competitions for WooCommerce, go to WooCommerce > System Status and ensure there are no errors, especially pertaining to WordPress memory limit. Additionally, ensure Inventory management is enabled under WooCommerce > Settings Products.

Note: Competitions for WooCommerce will not work if “Allow customers to place orders without an account” is enabled. Please turn this option off in WooCommerce > Settings > Accounts & Privacy settings.

The Competitions for WooCommerce plugin requires cronjobs in order to end competitions on time. If this is not important for your competition website, you can skip cronjob setup. Relist cronjob is mandatory if you want to setup automatic relisting.

every minute: /usr/local/bin/curl --silent http://www.your-domain.com/?competitions-cron=check

every hour: /usr/local/bin/curl --silent http://www.your-domain.com/?competitions-cron=relist

Path to curl can be /usr/local/bin/curl or /usr/bin/curl etc depending on your hosting setup. Cronjobs should be setup by your hosting provider. If your host does not support cronjobs, we advise you to find an alternative host (you can contact us for help and suggestions).

Settings

↑ Nach oben

Plugin settings are located in WooCommerce > Settings > Competitions.

Competitions Options List

↑ Nach oben

Within plugin settings, you can enable or disable whether past and future competitions display on the competitions page. Another useful setting is whether to mix regular products with competitions or just show competitions on separate page (defined via Competitions Base Page dropdown, see screenshot):

check full size competition settings screenshot

Screenshot below shows WooCommerce Product List with active competitions. Competition status icons are not displayed on the screenshot – from WooCommerce 3.4.0 update, WooCommerce developers removed that column in product list (as a result of users’ feedback). There is way to restore it back using this plugin https://wordpress.org/plugins/woocommerce-product-type-column/ (status icon missing on screenshot below):

Competitions for WooCommerce Documentation 1

Usage

↑ Nach oben

Features

↑ Nach oben
  • Integrates with WooCommerce via custom competition product type and competition filter in product list (wp-admin)
  • 2 competition types – with and without ticket numbers with option to answer a question or solve a puzzle (skill based competitions)
  • Competition can have one or more winners, Users can win single or multiple prizes
  • Competition ticket price can be zero, works with credit systems like TeraWallet / Credit payment gateways
  • Define Instant wins and import instant win ticket numbers and prize description via CSV file
  • Refund tickets with single click if competition has failed
  • Instantly finish competition if max number of tickets sold
  • Option to pick numbers from list or to assign number randomly without picking
  • Tickets table can be sorted in tabs if there are many tickets
  • Lucky dip button with option to select quantity – example: click here to buy 5 random tickets
  • Option to use alphabet prefix for ticket numbers (A1…A50, B1…B50, etc)
  • Option to extend lottery end date in case not enough tickets were sold (with all previously sold tickets – ticket rollover for failed competitions)
  • Manual and automatic competition relisting with option to save or delete previous data after relisting
  • Define minimum and maximum number of tickets available, max tickets per user, number of winners and multiple wins per user
  • Create lottery from any type of existing WooCommerce product – simple, virtual or downloadable products, and set start and end time
  • Easy control of competitions listing – display competitions along with other products or on separate page
  • Entry lists page for competitions
  • Widgets with ending soon, future, latest / recent, featured, recently viewed, random and my competitions
  • Email notifications (with editable templates) for competition win, fail, finish, no luck, lottery fail for customers, lottery extended
  • Competition product has lottery icon (label) on thumbnail
  • Competition single page has new tab “Competition History”
  • Users have My Tickets page under My Account or you can use shortcode [my_competitions] to display users competitions won and ones that user participates in
  • Option to enter winner manually – useful if you use 3rd party draw like random.org or national lottery numbers
  • Export competition participants with all details in CSV / Excel
  • Competition product has icon which describes different lottery status: active, finished, finished and paid, failed (wp-admin)
  • Manually delete any ticket via WooCommerce order management
  • Users can log in at a later stage of checkout (i.e., guest checkout)
  • Enable / disable progress bar and countdown timer in product loop / archive
  • Support via Elementor for setting up single competition pages with easy-to-edit templates
  • WooCommerce REST API support – tutorial
  • HPOS support
  • WPML compatible, translation files
  • Cronjobs required – if your host does not support 1 minute cronjobs you can use 3rd party cron service like easycron – plugin works with WP cron too

Setting up your first competition

↑ Nach oben

Setting up a new competition with Competitions for WooCommerce is similar to adding a new WooCommerce product except you need to set a couple more parameters specific to competitions:

  1. Go to Products => Add Products
  2. Add title, description, images, featured image, select category – all things you do when adding a regular product
  3. In Product Data dropdown menu, select Competition. You will see a new tab in the left menu named Competition.
  4. Enter all details (options not marked optional are mandatory and must be filled):
    • Fill all required inputs like price, min / max tickets, number of winners, start and end competition dates
    • Enable “Instant winner” checkbox for instant wins and add instant win numbers with “Add new” button or scroll down to “Competitions Instant Tickets” block to import CSV with instant win tickets and prize descriptions
  5. Publish competition by clicking on Publish button.
  6. Once you publish the competition, go to your shop or competition page and you should see the new competition product.

Overview of the competition workflow

↑ Nach oben

Once a site owner creates a new competition and publishes it, the competition is visible on the website and users can purchase tickets (with numbers) or entries (without numbers). After a competition’s end date is reached, contestants either lose or win and the Site owner is to fulfill / deliver prize or reward defined in the competition description.

Custom Templating

↑ Nach oben

If you need to customize plugin templates first thing to do is to copy content of plugin_dir/templates to your_theme/woocommerce so you do not overwrite changes when you update plugin. All changes and modifications should be done on files located in your_theme/woocommerce/.

List of Shortcodes

↑ Nach oben

List of available shortcodes in Competitions for WooCommerce. Some shortcodes accept optional orderby and order attributes.

  • shows competitions similar to products shortcode in WooCommerce – [competitions ids="1,2,3,4,5" columns="4" orderby="title" order="asc"]
  • shows featured competitions – [featured_competitions], [featured_competitions per_page="12" columns="4" order="desc" orderby="meta_value" future="no"]
  • shows recently added competitions – [recent_competitions], [recent_competitions per_page="12" columns="4" order="desc" orderby="meta_value" future="no"]
  • shows ending soon competitions – [ending_soon_competitions], [ending_soon_competitions per_page="12" columns="4" orderby="date" order="desc"]
  • shows future competitions (those that did not start yet) – [future_competitions], [future_competitions per_page="12" columns="4" orderby="date" order="desc"]
  • shows finished competitions – [finished_competitions], [finished_competitions per_page="12" columns="4" orderby="date" order="desc"]
  • shows competitions in which user participates and are active, user has to be logged in for this to work – [my_active_competitions]
  • shows competitions in which user participated, user has to be logged in for this to work – [my_competitions]
  • shows competitions which user won, user has to be logged in for this to work – [won_competitions]
  • shows table in which each row contains competition name, date and winners – [competitions_winners]
  • shows lucky dip button which adds defined quantity of tickets to cart, works only on single competition page  – [competition_lucky_dip_button qty="3"]

Please note that there is no paging when you use shortcodes (same as with WooCommerce shortcodes). Per page attribute means how many items will be displayed on that particular page without paging.

FAQ

↑ Nach oben
  1. Do you have list of hooks and filters? – Yes, please contact us for complete list.
  2. Are there known issues? – Yes, if you have huge number of tickets with randomly assign ticket option you might get problems with php memory size and max_input_vars php limit which would have to be increased (or max number of tickets decreased).
  3. Does Competitions for WooCommerec work with object cache? – Yes, but we recommend to exclude its domain from cache, name of domains is competitions_for_woocommerce
  4. I use Elementor and I do not see anything in frontend? – Please go to Elementor Settings > Experiments and disable “landing pages”.
  5. How can I import instant win tickets? – Easy, on edit competition page scroll down to “Competitions Instant Tickets” block, select CSV file and save changes. CSV format is simple: ticket number,prize description.