Warning:
Always backup WordPress database and files before updating to latest version, just in case!
Always backup WordPress database and files before updating to latest version, just in case!
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/templates/ - otherwise some new features might not show up on the site.
** Version 2.2.7 **
- Fix: recent_lotteries shortcode added lottery_status="active" attribute
** Version 2.2.6 **
- Fix: my_lotteries shortcode fix
- Fix: check in remove_lottery_from_user_metafield function
** Version 2.2.5 **
- Fix: datepicker JS naming
** Version 2.2.4 **
- Fix: db optimization (indexing)
- Add: always use default datepicker JS
** Version 2.2.3 **
- Fix: draw issue when having more prizes than tickets sold
- Fix: small fix for HPOS compatibility
- Fix: code cleanup
** Version 2.2.2 **
- Fix: performance improvement, removed obsolete add_post_meta lines
** Version 2.2.1 **
- Fix: fatal error in email templates
** Version 2.2.0 **
- Add: lottery related sort for base page
- Add: lottery relates sort in customizer for shop page
- Fix: variables for email actions
** Version 2.1.12 **
- Add: HPOS compatibility
- Add: scheduled sale price like simple products
- Add: actions woocommerce_lottery_product_loop_lotteries_winners_header, woocommerce_lottery_product_loop_lotteries_winners_body
- Fix: code cleanup
** Version 2.1.11 **
- Fix: optimization - reduced number of calls to db
- Add: optimized function lottery_get_user_display_name_by_id() instead of get_userdata()
** Version 2.1.10 **
- Fix: sleep() check
- Fix: datetime format for lottery_winners shortcode
- Fix: warnings
** Version 2.1.9 **
- Add: filter woocommerce_lottery_max_purchase_quantity
** Version 2.1.8 **
- Fix: cache
- Fix: small bugs
** Version 2.1.7 **
- Fix: Dokan double ticket problem
- Add: filter woocommerce_lottery_entry_list_perpage
- Fix: entry list compatibility with Yoast SEO
- Fix: entry list compatibility with RankMath SEO
** Version 2.1.6 **
- Fix: cache problem
** Version 2.1.5 **
- Fix: duplicate queries
- Fix: JS quantity bug
- Add: login at later stage of checkout
** Version 2.1.4 **
- Fix: lottery stuck if there is on hold order for lottery
- Fix: template bug with future lotteries
- Fix: show additional custom content in email notifications
- Fix: caching and future lotteries
** Version 2.1.3 **
- Fix: translations
- Fix: lottery winners shortcode problem
- Add: lottery winners shortcode paging
** Version 2.1.2 **
- Fix: potential performance issue
- Fix: meta fields caching fix
- Fix: fatal error
** Version 2.1.1 **
- Fix: potential cache issue
** Version 2.1.0 **
- Add: entry lists
- Fix: lost password redirect
- Fix: checkout redirect
- Fix: stock decimals when cancelling order
** Version 2.0.6 **
- Fix: problem if MySQL auto_increment_increment variable has value bigger than 1
- Fix: show tickets available above progress bar
- Fix: performance
** Version 2.0.5 **
- Fix: performance
- Fix: stock input
** Version 2.0.4 **
- Add: show SKU
- Add: tickets sold label above progress bar (or tickets available)
- Fix: don't show future lotteries if this option is enabled in lottery settings
** Version 2.0.3 **
- Fix: participate button tax display issue
- Fix: sourceMappingURL not found
- Add: fully tested with PHP8 and WooCommerce 5.0
** Version 2.0.2 **
- Fix: small bug
- Fix: countdown timer JS issue
** Version 2.0.1 **
- Add: [vendor] tag for email notifications recipients
- Fix: small bugs
** Version 2.0.0 **
- Add: Elementor support
- Add: updated POT translation file
- Fix: lotteries winners shortcode problem
WooCommerce Lottery is a lottery / giveaway extension for WooCommerce. We tried to make it easy to use but also to include all features you might need for a giveaway or lottery. With this plugin you will get a powerful lottery solution for WordPress which is easy to setup and customize.
With WooCommerce Lottery plugin you can setup WordPress lottery website or giveaway in less than 30 minutes (assuming you have payment processor ready - for giveaways you don't even need payment processor). WooCommerce Lottery plugin integrates seamlessly with WooCommerce and no special knowledge is needed.
Watch video explainer for WordPress Lottery plugin
Watch video explainer for WordPress Lottery with Pick Number mod plugin
Source: https://codex.wordpress.org/Managing_Plugins#Installing_Plugins
You can install plugin via WordPress "Add New" plugin - to do that download zip with plugin only (installable WordPress files), click add new and that's it. In case you do not have permissions to upload to plugins/ directory you will need FTP login info and upload plugin via FTP. Make sure to install WooCommerce before you activate WooCommerce Lottery plugin.
Alternative setup. After downloading WooCommerce lottery plugin, extract plugin zip and upload it to your plugins directory - wp-content/plugins/ folder of your Wordpress installation. Since this is extension for WooCommerce you need to install WooCommerce before activating the plugin. WooCommerce plugin which can be downloaded here.
If you need help installing Wordpress see the link here
Once you installed and activated WooCommerce go to WooCommerce > System Status and make sure that you don't have red colored errors (specially for WP memory limit). Make sure to enable inventory management in WooCommerce!
WooCommerce Lottery plugin uses cronjobs and you have to setup one cronjob:
Here is screenshot of cronjobs page and setup in DirectAdmin control panel
More details about cronjobs can be found by googling "how to add cronjob in cPanel / DirectAdmin". If you don't know how to add cronjob the best and the easiest way is to email your hosting support to do it for you (purpose of hosting support are tasks like helping you with cronjobs, our support helps you with plugin issues - cronjobs are hosting related task / issue).
Why do we use and suggest real server cronjobs? Plugin will work with WP cron but disadvantage of WP Cron is that it will trigger only when someone visits your website, if there is no site activity for say 3 days, the cron will not be triggered for 3 days but next time you have visit on your website. Real server cronjobs do not depend on website activity and are run in fixed defined intervals as set in cronjob config.
If your hosting company does not support one minute cronjobs we suggest that you move your website to more serious hosting company or use service like EasyCronOur plugin is meant to be used as ecommerce solution which will / should earn money so we suggest you to invest in proper hosting (which at least supports one minute cronjobs).
Why do we use cronjobs? - WordPress cronjob is run on every visit (page load), it's fine for small and not so busy websites. But sometimes you do not have enough hits (visitors) and lottery will be finished when visitor loads page (and cronjob) instead on its end timestamp. User visit which triggers cron will be taking some time to process everything so it is better that cron does that in background than leave user waiting cron tasks to finish. That's why we use real cronjobs - to make sure your lotteries will end on time. Also on busy websites you need to turn off WordPress cron and create cronjob for it to avoid cron being loaded on every hit and generating performance penalty.
Source: https://woocommerce.com/document/importing-woocommerce-sample-data/
WooCommerce comes with sample data which you can import, dummy data file is /wp-content/plugins/woocommerce/dummy_data.xml Sample data does not include lottery products, it provides data to populate WooCommerce store with some demo products, ratings, comments, etc. Steps to import demo data to your WordPress WooCommerce site:
Importing dummy data can take some time, specially on slow Internet connections. Be patient and do not close or refresh browser tab until import operation is completed.
Setting up new lottery is easy:
In WooCommerce Settings -> lottery you can set lottery base page where you display a list of all lotteries (archive page). Please see note if you want to set your lottery page as home page. If you have lottery only website there is no need to setup lottery base page, you can use WooCommerce shop page.
When creating new lottery make sure to create it via add new product rather than cloning product or existing lottery. If you clone / copy existing lottery all custom meta will be cloned. That means if lottery has finished, meta field that defines finished lotteries will also be cloned and lottery will always look like it is finished. To create new lottery from existing one use relist feature.
If you need to trash / cancel order please go to edit order, cancel it by changing order status and then trash it. That is proper way to do order cancellation for lotteries, otherwise (if you just trash order) log data can be left in lottery log tables.
Make sure that when setting up lottery site your lottery base page is different than your home page. If you need lotteries on home page use shortcodes or widgets to display them on your home page.
After you activate WooCommerce Lottery plugin couple new options will appear:
New WooCommerce product type lottery:
Lottery edit product screenshot (with Pick Number Mod addon for WooCommerce Lottery):
Settings are mostly self explainable, please see screenshot below. You can enable or disable showing past and future lotteries, another useful setting is whether to mix regular products with lotteries or just show lotteries on separate page (defined via WC Lottery Base Page dropdown option, see screenshot).
Screenshot above includes available settings for Pick Number Mod addon for WooCommerce Lottery (options listed under title "Lottery pick number and answer" are related to Pick Number Mod addon).
On screenshot below you can see how product list with lotteries looks like. Lottery status icon colors: red - active lottery, orange - finished, red - failed. Column “product type” (with icons) on the products admin screen in WooCommerce was removed in version 3.4.0 and in order to see icons you need to install WooCommerce Product Type Column plugin. See FAQ item no 30.
If lottery has failed, in product / lottery details you will see option to "Refund" or buttons to "Relist" or "Extend" lottery. "Refund" enables you to refund all tickets to participants if your lottery rules require that and your payment gateway supports refunds. "Extend" allows extension of end date keeping all current participants (and their orders) while "Relist" resets lottery and it starts with 0 participants. Only failed lotteries can be extended (or refunded) while all finished lotteries can be relisted. See FAQ item no 32.
Once lottery is finished you can view winners on single lottery page or in wp-admin edit product page. Below are screenshots.Beside that you can create my lotteries page for users where you can use this shortcode: show user's lotteries (active lotteries in which user participates and list of user's won lotteries) -[my_lotteries]
In lottery details block with lottery history entries enables you to view and delete ticket orders, export them to CSV or Excel and view history prior relisting. Check screenshot below. Failed lotteries can be relisted (restarted - meaning participants will be lost) or extended (end date will be changed) keeping all current participants.
Winner(s) is / are picked randomly once lottery is finished or you can manually enter winning numbers in case you have Pick Number Mod addon. Plugin uses mt_rand PHP function to randomly pick winners. PHP function mt_rand() which provides solid randomization for this purpose.
If you use WooCommerce Lottery (also with Pick Number Mod addon) and for example you have setup lottery with max 100 tickets and min 50 tickets, then if you sell 55 tickets winner(s) will be choosen between those 55 tickets not all 100 tickets.
With Pick Number Mod addon you can get also different behaviour with enabled checkbox option called "Manual winner picking", meaning that when lottery ends and after you generate randomly winning numbers (or use national lottery numbers or random.org) you will enter numbers in text input field. It is then possible that your lottery could end without winners (if none of participants picked right number(s)).
With Pick Number Mod and question / answers feature enabled winners will be choosen among those with correct answer only. In case you are manually entering winning numbers you will need to be sure that winning number has correct answer - this can be seen in lottery history table block (which you can export to Excel or CSV for easier management).
Here is a list of all available plugin shortcodes. Some shortcodes accept optional orderby and order attributes. Shortcode [lotteries] implements paging and attributes like [products] shortcode in WooCommerce - see list of all available options here. Other shortcodes do not implement those attributes.
[lotteries_winners], [lotteries_winners paginate="true" limit="12" order="desc"]
[featured_lotteries], [featured_lotteries paginate="true" limit="12" columns="4" orderby="date" order="desc"]
[ending_soon_lotteries], [ending_soon_lotteries paginate="true" limit="12" columns="4" order="desc" future="no" lottery_status="active"]
[recent_lotteries], [recent_lotteries paginate="true" limit="12" columns="4" orderby="date" order="desc" lottery_status="active"]
[future_lotteries], [future_lotteries paginate="true" limit="12" columns="4" orderby="date" order="desc"]
[lotteries ids="1,2,3,4,5"]
this shortcode supports attributes (pagination and sort) similar to WooCommerce [product] shortcode complete list of options is here[my_lotteries], [my_lotteries paginate="true" limit="5"]
[finished_lotteries], [finished_lotteries paginate="true" limit="12" columns="4" order="desc"]
[lottery_lucky_dip_buton qty="5" label="buy 5 tickets"]
[lottery_all_instant_wins paginate="true" limit="5" orderby="title"]
[lottery_all_instant_winners limit="5"]
[lottery_instant_winners_tab]
Reference for each shortcode we have can be found in public\class-wc-lottery-shortcodes.php and public\class-wc-shortcode-lotteries.php
This plugin is created by wpgenie. Check out our Envato profile where you can support us by purchasing our plugins, give us feedback and post your ideas and feature requests, ask for support and rate our items. Check out our free stuff.
We do WordPress developing, plugins for WordPress & WooCommerce, eCommerce sites based on WooCommerce, WordPress performance optimization and managed WordPress hosting.