As you read articles/posts on ecommerce optimization, specifically checkout optimization, a popular theme emerges: The Checkout Progress Bar. The idea is to provide your visitors some kind of visual feedback that they are making progress. It tells them how far along they are before the purchase is complete. Conversely, it tells them how much longer before they can own the product/service they are vying for.
With this in mind, I googled for a free plugin that would accomplish just that. My search ended fruitless (almost). I did hit this gem of a plugin called Progress Bar. This is a simple plugin that can be used anywhere on a WordPress site.
Steps
In this article, my aim is to create your own customized checkout progress bar without the use of any paid plugins. You will need
- Download the Progress Bar plugin from the WordPress plugin repository
- Make some code changes (PHP and JS included). Download from github.
The code changes are shown below. The first change is in your theme/child theme’s functions.php file. Two things are happening here:
- Hooking into the “woocommerce_checkout_before_customer_details” action hook to display the Progress Bar. We use the shortcode for the Progress Bar because it allows to send in parameters for styling and appearance.
- Loading the JavaScript file that will manipulate the Progress Bar based on how much of the Checkout Form has been validated.
The second file is the JS script that checks in real-time which mandatory fields have been validated. Then it calculates the progress (in pixels) by simply dividing the “number of fields validated” by the “number of fields that require validation”. It also accounts for the “Shipping Address Same as Billing Address” checkbox.
The end result is you get a progress bar for your WooCommerce Checkout Page.
Notes on Customization
The CSS for the progress bar can be easily customized. Follow the instructions on this link. Also, note that the plugin has quite a few options that can be used for customizing the look and feel of the Progress Bar.
Leave a Reply