Posts

Custom WooCommerce Plugin Development

Image
A complete tutorial on Custom WooCommerce Plugin Development. We’ll develop a WooCommerce plugin with step by step code explanation. On completion of this tutorial you will have a complete understanding of how to build a WooCommerce Plugin with admin and frontend stuff. I wrote this because I have come across many WooCommerce Plugin Development tutorials. But I never found a single one that covers all the aspects of a good WC plugin. This tutorial is a complete guide for all those who are looking for how to do Custom WooCommerce Plugin Development. Prerequisites For this tutorial, you must have good PHP/MySQL and WordPress WooCommerce Development skills. If you are new to PHP or WordPress world this tutorial is not for you. I am not going to explain what PHP If Statement or Function is. You must be very familiar with WordPress and WooCommerce Hooks, CPT, etc My goal in this tutorial is to combine all the things and show to an intermediate level developer to gain necessary skills for W...

How to add Flatsome Product On-Sale End Countdown

Image
Recently one of my client had a requirement and in this post I’ll show you how to add Flatsome Theme product on-sale end countdown. When you place a product on-sale for a cheaper price, you would possibly need your customers to be ready to see the initial price, so that they see the value comparison. To demonstrate a sale price your product need to incorporate actual price and sale price.   Luckily, Flatsome Theme has a countdown module and it can be added to any page using shortcode. In below code I added comments to explain [ux_countdown] shortcode usage, the first is for Admin side and 2nd is to include within functions.php or in custom plugin.     My client requirement was to add the countdown timer for products on-sale. When the product sale time ends it will not display anymore. It adds the counter for Simple & variable products. If you have set different sale-end time for each product variation. Below code will update the counter according to selected product ...

Flatsome Theme Customization

Image
In this post I’ll show you how to do flatsome theme customization. According to Themeforest its the #1 best selling WooCommerce theme ever. It’s a multiple-purpose responsive theme and can be used for any type of WooCommerce Project. Important Flatsome Template Files Flatsome theme has lot of files and directories, Below I’ll list some important files, which are used for WooCommerce frontend templates. Flatsome root directory It contains template files for Cart, Checkout & accounts pages page-cart.php page-checkout.php page-my-account.php Flatsome/wocommerce directory It contains template files for shop listing & product details pages archive-product.php single-product.php Flatsome/inc/woocommerce directory Below files contain functions for category, product, cart, checkout & accounts pages used within flatsome theme structure-wc-global.php structure-wc-category-page.php structure-wc-product-page.php structure-wc-product-box.php structure-wc-cart.php structure-wc-checkout...

7 Things You Should Never Do With Your WooCommerce Store

Image
If you are a WooCommerce Developer then you must have to agree with me about these “7 things you should never do with your WooCommerce store” . A store that loads slow, definitely loses prospective customers.   I have seen people with passion of starting online store fail due to insufficient information about the current trends. In recent years the web has been totally changed, it was a different thing 5 years ago. Now to stay within the competition, you have to know everything to be successful. Below are the list of 7 things you should never do with your WooCommerce store, I’ll go briefly on each of them. Never customize core WooCommerce plugin files Never use heavy theme Never use extra plugins Never use slow hosting Never use heavy product images Never customize theme core files Never hire cheap unskilled WooCommerce developer 1. Never customize core WooCommerce plugin files WooCommerce is a flexible eCommerce system. But to customize its core files you need good understanding o...

WooCommerce Checkout Page Fields

Image
In this post I’ll show you how to handle WooCommerce checkout page fields customization. The Checkout page is an eCommerce term that refers to pages shown to a customer during the step-by-step checkout process. WooCommerce Checkout Customization – Shipping or Billing Form Fields The shipping address is where you want products to be shipped, while the billing address is where you live or Where your bills are to be delivered. The eCommerce shipping is a service through which seller ships their products to buyers. A shipping form collects the shipping details of a customer. It must contain all required shipping fields.   Add WooCommerce Custom Shipping Field WooCommerce is a very flexible eCommerce system. We can easily customize the checkout page, it provides all the necessary hooks. Below are the three steps to add a custom field to WooCommerce checkout shipping form. Add the required field array() data and hook it to woocommerce_checkout_fields Field validation to check it must c...

Update WooCommerce Checkout Total with Postcode Field

Image
Sometime you want to update the checkout total based on a specific field. e.g how to update WooCommerce checkout total with postcode field. Enter the value in billing_postcode field and as you blur. The jQuery( ‘body’ ).trigger( ‘update_checkout’ ); will be triggered and the checkout total will be updated. Use the following code snippet within theme functions.php   Custom WooCommerce Plugin Development   Flatsome Theme Customization   WooCommerce Checkout Page Fields   Checkout Field Editor  

Send Additional WooCommerce Email

Image
Sometime you want to send additional WooCommerce email to certain address or to third party. To send such emails is not quite hard, if you know the right hooks. We need to hook our function when action is triggered and order is set to cancelled. We use hook woocommerce_order_status_processing_to_cancelled_notification It is triggered when order status changed from processing to cancelled. The hook accepts 1 parameter which is the $order_id. You can use this hook when orders are cancelled in case of some issues occurs e.g Payment Failed. The WooCommerce mailer class is loaded e.g WC()->mailer(); It has following parameters. $recipient: Email address of the person to notify. $subject: Subject of your email. $content: Content of Email. The ci_get_cancelled_notification_content() functions fetches our email contents. $headers: Tells mailer its HTML email. The wc_get_template_html() is a WooCommerce function that loads email template with contents passed in array. Add the following cod...