Using Post Expirator plugin for ending soon lotteries, auctions and group buy deals

post expirator plugin for wordpress

Ever wanted to have category called ending soon or starting today which are automatically populated based on auction, lottery, deal end / start date? One client did it with a free plugin so he does not need to use widgets or shortcodes for that purpose. Plugin called Post Expirator does the trick – among other things it can change (custom) product category on selected date.

Along with main features to modify, remove or completely delete content when the expiry date arrives plugin allows also some useful actions with posts / pages / products:

  • Change the status to “Draft”
  • Delete the post
  • Send the post to the Trash
  • Change the status to “Private”
  • Enable the “Stick to the top of the blog” option
  • Disable the “Stick to the top of the blog” option
  • Remove all existing categories, and add new categories
  • Keep all existing categories, and add new categories
  • Keep all existing categories, except for those specified in this change

For our example we will use “Remove all existing categories, and add new categories” action. First define product categories – something like on screenshot below (and ofcourse categorize auctions with Auctions product category):

You can use “do not mix” settings for auctions, lotteries and group buy / deals. Now in Settings -> Post Expirator we need to enable it for product post type (and disable it on for example posts and pages if you don’t need it there).

Post Expirator plugin comes with handy bulk edit option and can be bulk set but problem is that expiration category must be set for each auction manually, one by one. This can be done during auction post publishing when you enter all auction details so we don’t see this as huge problem.

After time set in above screenshot auction is categoriezed under Auctions -> Ending Soon category.

Benefits of this approach is that when you custom style product archive page same style will be applied to all products even custom ones like auctions, lotteries and group buy / deals.

Customizing loop for widgets and shortcodes is not that easy while customizing product categories is more easy and can be done for example with Elementor. You can also completely unpublish finished auctions, lotteries, group buy / deals, or move them to their special product category called for example Past Competitions.

Post Expirator plugin is well maintained, has solid user base (more than 100k installations) and top rating.

Debugging in WordPress (WP debug tips)

One of the most important things when developing is a way to locate source of the problem fast and with as much details as possible – which file and more specifially line of code caused the trouble.

WordPress has solid debug logger which can be complement with 3rd party plugins like Query Monitor and Debug Bar. First step is to edit wp-config.php file and set following constants:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
define( 'WP_DEBUG_LOG', true );

These lines will enable debug mode which will both displaying errors in frontend and log them in file located at /wp-content/debug.log – make sure to set define( ‘WP_DEBUG_DISPLAY’, false); if you are doing debugging on live production website (site is accessible online) so errors are not displayed to eventual visitors but only logged to a log file.

If WP_DEBUG has been enabled it is possible that this file is huge in size and best would be to delete it and let WordPress start logging from beginnig so you don’t end up inspecting debug.log with 500MB of debug info.

To limit what is logged into debug.log (for example you don’t want to log notices or warnings there are a lot of those entries and they are not particularly useful) you will need to use small mu plugin, create folder wp-content/mu-plugins/ and in that folder create for example file no-warnings-in-debuglog.php with content:

<?php


// no more notices and warnings in debug.log!
error_reporting ( E_ALL &  ~( E_NOTICE | E_WARNING) );

Fatal error will causing a white screen of death, and without WP_DEBUG enabled you will see only white screen without any error messages. Debug.log file can be viewed using your favorite text / code editor or from WordPress backend using plugin like Log Viewer.

But true power of WordPress debug logger comes with error_log() php function which you can use in your code in order to log something in wp-content/debug.log file in your custom code (you added for example in functions.php), plugin or theme template or gather and log other info you need (for example who accessed a page or viewed a product – example on pastebin).

With below statement you can even log a line in particular file in which error_log() function was invoked:

error_log( __LINE__ . ' i'm here!');

Since logging is unformatted you will need to use print_r or var_export to log variables like arrays and objects:

error_log( print_r( $log, true ) ); // useful for arrays
error_log( var_export( $object, true ) ); // any variable type, objects


SCRIPT_DEBUG is a related constant that will force WordPress to use the dev versions of core CSS and JavaScript files rather than the minified versions that are normally loaded. This is useful when you are testing modifications to any built-in .js or .css files. Default is false.

define( 'SCRIPT_DEBUG', true );

If you are trying to debug what is going on with your MySQL / MariaDB, you can add the following line to your wp-config.php file.

define( 'SAVEQUERIES', true );


This saves the database queries to an array which is then written to the debug.log.

There is also a way to rename debug.log file or move it to non default folder. For that you can use this in your wp-config.php:

define( 'WP_DEBUG_LOG', false ); // disable default log function
ini_set( 'log_errors', 1 ); // tell PHP to start logging to a file
ini_set( 'error_log', dirname(__FILE__)  . '/debug-folder/my_debug_1.log' );

Last line means that my_debug_1.log will be created in /path/to/your/wordpress/debug-folder/ my_debug_1.log – you can also use constant ABSPATH which is a WordPress defined constant specifying the root path of your installation.

In some cases you might want to write information to the log, even if it’s not technically an error but you need output something during development phase (useful to debug ajax requests for example). PHP has a function called error_log, that will print information to the error log for you (and saved to /wp-content/debug.log file). By default it does not print and format properly so here is wrapper for error_log, that uses print_r() to format arrays and objects properly before logging them:

if ( ! function_exists('write_log')) {
   function write_log ( $log )  {
      if ( is_array( $log ) || is_object( $log ) ) {
         error_log( print_r( $log, true ) );
      } else {
         error_log( $log );
      }
   }
}

WordPress debug.log just captures PHP errors – JavaScript errors are output to the browsers console log which is available in DevTools (or Firebug ) by pressing F12 in Chrome and clicking on Console tab. Complete WordPress reference page for debugging is here and documentation for error_log() PHP function is here.

Note: once everything is sorted and work done is ready for production – turn off all logs. Writing debug info to a file will have a performance hit on the server meaning you get slower load times for your website (along with huge security issue if WP_DEBUG_DISPLAY is not turned off!), especially these SAVEQUERIES and SCRIPT_DEBUG logs, so use them with caution if you have to debug on a production server.

WooCommerce Simple Auctions with SMS notifications

wsa sms notifications

Initial setup and requirements for WooCommerce Simple Auctions with SMS notifications

In this tutorial we will explain how you can enable true SMS notifications for (your auction website powered by Simple Auctions): new bid, auction finished, auction won, outbid note, reminder to pay and reserve failed notifications.

Developer also has specific integrations for many different plugins like WooCommerce, Contact Form 7, Event Espresso, Easy Digital Downloads, ClassiPress, AdForest, JobManager, Bulk SMS, WC Bookings etc. You can get access to all addons here.

To implement SMS notifications feature for WSA you will need two additional plugins WP SMS for WordPress (free) and WP SMS For WooCommerce Simple Auctions ($29). Next requirement is Twilio account to enable using their API for send SMS messages. In case you encounter any issue with setup you can always reach us via support ticket system and we will help you with setup.

wp sms twillio plugins for sms notifications

Once plugins are installed we can start with setting up Twillio account and API. On url https://www.twilio.com/console/projects/summary you will need to create new account / project and will get Account SID. Project will have also Auth Token and Twilio phone number (found under TRIAL NUMBER label) that is needed for WP SMS for WordPress to access API. See screenshot below:

twillio project setting for use with wp sms for wordpress plugin

Now we need to enter those values in WP SMS for WordPress settings, see screenshot below:

wp sms for wordpress settings

Now that all is set, we need to take care of key parameters phone number and message content – where to send SMS notification and what is actual content of message to be sent. To send SMS to a client you will need them to enter a mobile phone number able to receive SMS messages. WP SMS for WordPress allows shipping or billing phone number fields to be used but also allows creation of special custom meta user field that adds “Mobile Phone” input form to user profile.

It is up to site owner to define what user meta field will be used for SMS notifications phone number, all 3 ways are equal and there is no preferred option. For example if your clients did not make any purchases yet, they might not have entered billing or shipping phone number.

Also some clients might have billing and shipping phone number but they don’t want to receive SMS messages. In that case the best solution would be to enable “Add Mobile Number Field to User Profiles” and tell users to add their number there if they want SMS notifications.

WooCommerce Simple Auctions SMS Triggers / Notifications

Below is screenshot of available triggers / notifications and placeholder tags which are replaced with actual values like %auction_title% which becomes real title of auction in SMS message.

All notifications can be send to admin and customer (bidder), except for outbid note and reminder to pay notification that can be sent only to bidder who was outbidded or who has outstanding payment to make for won auction.

Admin does not have to add phone number to profile, you need to add number to input called “Receiver Number”. So you can receive different notifications on different phones (if needed). Along admin and customer, notifications for new bid, auction finished and auction won can be sent to user (vendor / post author). This is useful if you use multivendor plugin or you have users who add auctions and you want them to get notification.

Simple Auctions with SMS notifications settings explanation

Things to remember to check when you enable Simple Auctions with SMS notifications for production websites

Performance. For busy sites with a lot of bids performance penalty must be considered. If you have a lot of bids and you enable bid notification you need to expect that a lot of API calls will be made. Make sure you have adequate hosting meaning you will need proper (non cheap) dedicated server or cloud hosting with good connecitvity to Twillio. Make sure for production webistes logging is disabled. Drop us email if you need hosting suggestion.

Costs and Budget. High number of SMS notifications will cost more. For start enable only most important SMS notifications to keep SMS sending costs low and inside your budget. If you deplete your credit at Twillio, site will stop sending SMS notifications and some important ones could be missed.

Debugging and Logs. WP SMS for WordPress has nice detailed logging, activate it during testing phase then disable once everything is ready for better performance (you can monitor delivery at Twillio side). Do not forget about WP_DEBUG and WP_DEBUG_LOG settings in wp-config.php file!

Removal of users that have not logged in for more than 6 months to our support

In order to prevent potential security risks and data leaks we will be removing old user data and their tickets from our support. We want to keep user data and user’s info to minimal amounts possible. Users with orders will not be removed and users will have permanent access to downloadable files (free and paid).

This will also enforce support policy where only users who have valid support in Envato will be able to submit tickets. Plugin updates, documentation and free code snippets are and will be available to all users who purchased our plugins no matter of active support status.

ClassicPress – Get Simple Auctions, Lottery and Group Buy running on lightweight WordPress fork

ClassicPress Get Simple Auctions, Lottery and Group Buy running on lightweight WordPress fork

ClassicPress is WordPress long awaited fork of WordPress 4.9 (from version 2.0 fork of WP 6.2.x) without Gutenberg block editor, basically a lighter fork of WordPress with a few tweaks and improvements. It is under active development, has less bloat and has latest security patches. You will love overall simplicity and speed.

Most popular themes and plugins that work with WordPress 6.x are compatible with ClassicPress and there are forks of WooCommerce called ClassicCommerce and RankMath called Classic SEO (for more infos see link here).

Update: ClassicPress v2.0+ is a re-fork based on WordPress 6.2.x so brings ClassicPress a host of new features. Release notes are here. There is also https://directory.classicpress.net/ for native plugins and themes.

Setting up prerequisites in ClassicPress

First thing to do when installing one of our plugins on ClassicPress is to decide what version of WooCommerce you will use. ClassicCommerce is fork based on WooCommerce v3.5.3 and usually needs tiny compatibility plugin (get it here) which allows WooCommerce addons to work with ClassicCommerce. We used StoreFront theme.

classicpress-plugins-list
Plugin list in ClassicPress

Another option is regular WooCommerce installation but version that does not include (register) blocks for Gutenberg like WooCommerce v4.8.3 – scroll to the bottom and download version you want from wordpress.net/plugins repository. Once WooCommerce is ready you can install our plugins like you would on normal WordPress website.

Payment gateways tested in ClassicPress

Payment gateway we tested beside those that are preinstalled with WooCommerce is WooCommerce Stripe Gateway version 5.3.0 since that is the latest one that works fine with WooCommerce v4.8.2. Here is sample order done using test card with Stripe GW:

classicpress stripe order using test card plugin woocommerce stripe payment

Using our plugins on ClassicPress

There is no difference in how you use and work with plugins. Everything from documentation applies here. Install it, setup couple of products, make couple of orders and that’s it. Once deal, auction or lottery ends you and users will get notifications (if that is set), normal workflow is not affected in any way.

WooCommerce Lottery with Pick Number Mod addon
WooCommerce Lottery with Pick Number Mod addon

Here is screenshot of how auction product looks like:

ClassicPress with WooCommerce Simple Auction auction single product page

And screenshot with WooCommerce Group Buy / Deals product:

classicpress group buy deal product
Group Buy / Deal single product page

In this simple guide we have shown how you can use our plugin on ClassicPress setup and enjoy its superb performance. Easy on hosting and great for your visitor’s user experience.

Hooks Visual Guide – WooCommerce Single Product Page Actions

Hooks visual guide will help you customize your WooCommerce pages by rearranging elements or adding additional features on single product page. Template hooks are convenient for customizing templates of our plugins like Simple Auctions, Lottery and Group Buy. Easily move and rearrange page elements like progress bar, buy now, texts, countdown timers etc. since all elements are hooked onto existing WooCommerce template hooks (both for single product and for product archive elements).

Here is one example of how to run a shortcode (for our WooCommerce Lottery Pick Number addon) just above buy button on single product page:

add_action( 'woocommerce_after_add_to_cart_quantity', 'wpgenie_add_shortcode_lottery_lucky_dip_buton', 40 );

function wpgenie_add_shortcode_lottery_lucky_dip_buton(){

	echo do_shortcode( '[lottery_lucky_dip_buton qty="5" label="buy 5 tickets"]' );
}

WooCommerce Hooks Visual Guide

Best visual WooCommerce hook (both template and other) guide can be found here – by clicking on each page you will see how hooks are arranged through every WooCommerce page:

WooCommerce Single Product Page Hooks Visual Guide

This is complete list of template hooks:

<?php
/**
 * WooCommerce Template Hooks
 *
 * Action/filter hooks used for WooCommerce functions/templates.
 *
 * @author 		WooThemes
 * @category 	Core
 * @package 	WooCommerce/Templates
 * @version     2.1.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

add_filter( 'body_class', 'wc_body_class' );
add_filter( 'post_class', 'wc_product_post_class', 20, 3 );

/**
 * WP Header.
 *
 * @see  wc_generator_tag()
 */
add_action( 'get_the_generator_html', 'wc_generator_tag', 10, 2 );
add_action( 'get_the_generator_xhtml', 'wc_generator_tag', 10, 2 );

/**
 * Content Wrappers.
 *
 * @see woocommerce_output_content_wrapper()
 * @see woocommerce_output_content_wrapper_end()
 */
add_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
add_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );

/**
 * Sale flashes.
 *
 * @see woocommerce_show_product_loop_sale_flash()
 * @see woocommerce_show_product_sale_flash()
 */
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 );

/**
 * Breadcrumbs.
 *
 * @see woocommerce_breadcrumb()
 */
add_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );

/**
 * Sidebar.
 *
 * @see woocommerce_get_sidebar()
 */
add_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );

/**
 * Archive descriptions.
 *
 * @see woocommerce_taxonomy_archive_description()
 * @see woocommerce_product_archive_description()
 */
add_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
add_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 );

/**
 * Products Loop.
 *
 * @see woocommerce_result_count()
 * @see woocommerce_catalog_ordering()
 */
add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
add_action( 'woocommerce_no_products_found', 'wc_no_products_found' );

/**
 * Product Loop Items.
 *
 * @see woocommerce_template_loop_product_link_open()
 * @see woocommerce_template_loop_product_link_close()
 * @see woocommerce_template_loop_add_to_cart()
 * @see woocommerce_template_loop_product_thumbnail()
 * @see woocommerce_template_loop_product_title()
 * @see woocommerce_template_loop_category_link_open()
 * @see woocommerce_template_loop_category_title()
 * @see woocommerce_template_loop_category_link_close()
 * @see woocommerce_template_loop_price()
 * @see woocommerce_template_loop_rating()
 */
add_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
add_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );

add_action( 'woocommerce_before_subcategory', 'woocommerce_template_loop_category_link_open', 10 );
add_action( 'woocommerce_shop_loop_subcategory_title', 'woocommerce_template_loop_category_title', 10 );
add_action( 'woocommerce_after_subcategory', 'woocommerce_template_loop_category_link_close', 10 );

add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );

/**
 * Subcategories.
 *
 * @see woocommerce_subcategory_thumbnail()
 */
add_action( 'woocommerce_before_subcategory_title', 'woocommerce_subcategory_thumbnail', 10 );

/**
 * Before Single Products Summary Div.
 *
 * @see woocommerce_show_product_images()
 * @see woocommerce_show_product_thumbnails()
 */
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
add_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 );

/**
 * After Single Products Summary Div.
 *
 * @see woocommerce_output_product_data_tabs()
 * @see woocommerce_upsell_display()
 * @see woocommerce_output_related_products()
 */
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );

/**
 * Product Summary Box.
 *
 * @see woocommerce_template_single_title()
 * @see woocommerce_template_single_rating()
 * @see woocommerce_template_single_price()
 * @see woocommerce_template_single_excerpt()
 * @see woocommerce_template_single_meta()
 * @see woocommerce_template_single_sharing()
 */
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );

/**
 * Reviews
 *
 * @see woocommerce_review_display_gravatar()
 * @see woocommerce_review_display_rating()
 * @see woocommerce_review_display_meta()
 * @see woocommerce_review_display_comment_text()
 */
add_action( 'woocommerce_review_before', 'woocommerce_review_display_gravatar', 10 );
add_action( 'woocommerce_review_before_comment_meta', 'woocommerce_review_display_rating', 10 );
add_action( 'woocommerce_review_meta', 'woocommerce_review_display_meta', 10 );
add_action( 'woocommerce_review_comment_text', 'woocommerce_review_display_comment_text', 10 );

/**
 * Product Add to cart.
 *
 * @see woocommerce_template_single_add_to_cart()
 * @see woocommerce_simple_add_to_cart()
 * @see woocommerce_grouped_add_to_cart()
 * @see woocommerce_variable_add_to_cart()
 * @see woocommerce_external_add_to_cart()
 * @see woocommerce_single_variation()
 * @see woocommerce_single_variation_add_to_cart_button()
 */
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
add_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );
add_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );
add_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 );
add_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 );
add_action( 'woocommerce_single_variation', 'woocommerce_single_variation', 10 );
add_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 );

/**
 * Pagination after shop loops.
 *
 * @see woocommerce_pagination()
 */
add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );

/**
 * Product page tabs.
 */
add_filter( 'woocommerce_product_tabs', 'woocommerce_default_product_tabs' );
add_filter( 'woocommerce_product_tabs', 'woocommerce_sort_product_tabs', 99 );

/**
 * Additional Information tab.
 *
 * @see wc_display_product_attributes()
 */
add_action( 'woocommerce_product_additional_information', 'wc_display_product_attributes', 10 );

/**
 * Checkout.
 *
 * @see woocommerce_checkout_login_form()
 * @see woocommerce_checkout_coupon_form()
 * @see woocommerce_order_review()
 * @see woocommerce_checkout_payment()
 */
add_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_login_form', 10 );
add_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
add_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );
add_action( 'woocommerce_checkout_order_review', 'woocommerce_checkout_payment', 20 );

/**
 * Cart widget
 */
add_action( 'woocommerce_widget_shopping_cart_buttons', 'woocommerce_widget_shopping_cart_button_view_cart', 10 );
add_action( 'woocommerce_widget_shopping_cart_buttons', 'woocommerce_widget_shopping_cart_proceed_to_checkout', 20 );

/**
 * Cart.
 *
 * @see woocommerce_cross_sell_display()
 * @see woocommerce_cart_totals()
 * @see woocommerce_button_proceed_to_checkout()
 */
add_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' );
add_action( 'woocommerce_cart_collaterals', 'woocommerce_cart_totals', 10 );
add_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );

/**
 * Footer.
 *
 * @see  wc_print_js()
 * @see woocommerce_demo_store()
 */
add_action( 'wp_footer', 'wc_print_js', 25 );
add_action( 'wp_footer', 'woocommerce_demo_store' );

/**
 * Order details.
 *
 * @see woocommerce_order_details_table()
 * @see woocommerce_order_again_button()
 */
add_action( 'woocommerce_view_order', 'woocommerce_order_details_table', 10 );
add_action( 'woocommerce_thankyou', 'woocommerce_order_details_table', 10 );
add_action( 'woocommerce_order_details_after_order_table', 'woocommerce_order_again_button' );

/**
 * Auth.
 *
 * @see woocommerce_output_auth_header()
 * @see woocommerce_output_auth_footer()
 */
add_action( 'woocommerce_auth_page_header', 'woocommerce_output_auth_header', 10 );
add_action( 'woocommerce_auth_page_footer', 'woocommerce_output_auth_footer', 10 );

/**
 * Comments.
 *
 * Disable Jetpack comments.
 */
add_filter( 'jetpack_comment_form_enabled_for_product', '__return_false' );

/**
 * My Account.
 */
add_action( 'woocommerce_account_navigation', 'woocommerce_account_navigation' );
add_action( 'woocommerce_account_content', 'woocommerce_account_content' );
add_action( 'woocommerce_account_orders_endpoint', 'woocommerce_account_orders' );
add_action( 'woocommerce_account_view-order_endpoint', 'woocommerce_account_view_order' );
add_action( 'woocommerce_account_downloads_endpoint', 'woocommerce_account_downloads' );
add_action( 'woocommerce_account_edit-address_endpoint', 'woocommerce_account_edit_address' );
add_action( 'woocommerce_account_payment-methods_endpoint', 'woocommerce_account_payment_methods' );

More details are here.

Problem when accessing support with Envato credentials

We have identified problem when accessing support system using Envato credentials. In case you experienced issues during access please contact us to open account for you so you can get proper access to support and be able to open support tickets.

Problem is manifested as loop during login ie no redirection to open ticket form after login via Envato due to JS error.

WooCommerce Lottery – Give ticket for free when client purchase another item

We had couple of inquries for WooCommerce Lottery if it is possible to give ticket for free and allow clients to participate in prize draw when they purchase regular items sold on websites. This is possible and relatively easy to setup using our plugin. If you want to give users ticket number you will need Pick Number Mod addon for WooCommerce Lottery.

Easiest and fastest solution, would be that you create new lottery product and treat it as regular simple product so when someone purchase it you will ship actual item, (or give user access for download, etc) but also state that user will participate in lottery and could win a prize after purchase.

It is possible to change text from “Participate now for” via translations to anything you like and thing might be more suitable.

That lottery product was setup like this (here we use only WooCommerce Lottery without Pick Number Mod addon in this example):

If you want more complex solution then you will need 3rd party plugin which implements Buy One, Get One Free option / feature for WooCommerce.

In this tutorial I used PW WooCommerce BOGO Free plugin which is really trivial to setup and use. After installation you need to publish promotion and for each purchase of regular product you can add lottery ticket for free if price is lower or equal to product you purchased. There are plenty of similar plugins which you can use for this purpose – all should work just fine.

Here are couple of screenshots to see how this looks like on website during checkout:

Please note that you need to manually add lottery ticket to cart, plugin does not add it automatically. This implementation is handy if you want to use question / answers.

On last screenshot you can see how sample lottery / prize draw was setup. Please note WooCommerce Lottery and Pick Number Mod addon are enabled in this test setup.

Important thing to setup is minimum number of tickets for draw to be done, max number of tickets can be increased or decreased whole time during lottery active phase but make sure you don’t set max tickets below number of sold tickets since that can result with unexpected behaviour.

Keep on your mind that with this solution users would be able to participate by buying lottery ticket directly since we have not implemented anything that would prevent purchasing ticket directly by going to lottery product single page. If you need lottery to be restricted only for those who purchase something else you might need to get different plugin for “Buy One, Get One Free” or get pro version for this plugin.

Now here you can see screenshots of implementation without Pick Number Mod addon. Key difference is that there is no ticket number and that draw will be automatically done once lottery ends (no manual pick winner option – plugin will do that automatically using mt_rand function from all participants – there will always be 1 winner if there is at least 1 participant).