:::: MENU ::::

Create WooCommerce custom plugin

I have thought to put together a mini series covering the basics and day to day task solving tips and tricks of WooCommerce.For now, this first article will cover the basics of creating a custom plugin for your WooCommerce site or how to create a plugin in woocommerce, and provide you with a plugin skeleton to download and use as a starting point. I assume you are familiar with basic WordPress plugin development, and you are moving forward to learn Woocommerce plugins. So, let’s get going!

WooCommerce is a fabulous ecommerce solution, but creating a website or shop is a very personal endeavor, and you are likely to want to change some functionality or behavior of the stock WooCommerce plugin. We often look for simple solutions, and therefore we can be drawn to editing the core files.Honestly, we should avoid this urge. Fortunately, though not as flexible as Magento, WooCommerce provides a lot of action hooks, filters, template files and “template functions” to allow for customizations. Writing a plugin allows us to cleanly separate and keep track of our custom code, and renders WooCommerce upgrades a relatively painless process.

What is an action?

An action in WordPress allows you to execute code triggered at a specific point in the page response process, for instance upon displaying a comment.

What is a filter?

Similar conceptually to an action, filters allow you to modify data at specific points in the WordPress page response process, for instance removing profanity from a comment.

What is a template?

A template is a file that contains a mix of HTML and PHP code and renders a page, a part of a page, or an email. Templates can be overridden by creating a file of the same name in a special location within your theme or child theme.

What is a template function?

A “template function” is a function that begins with if ( ! function_exists( ‘function_name’ ) {… If your plugin defines this function first it will be called in place of the default function and allow you to override its behavior with your own.

Writing a custom plugin largely allows you to alter the functionality and behavior of WooCommerce; to customize the look and feel the preferred method is to create a custom child theme.

The Plugin Skeleton

Name your WooCommerce custom plugin as you will, i am naming it as woocommerce-company-name. Although not strictly necessary with a self-authored plugin, it’s good practice to check if WooCommerce is active, and also perform a check to ensure a class with the same name as your plugin doesn’t already exist:

if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
  if ( ! class_exists( 'WC_Helloworld' ) ) {

Next, it’s again good practice though not necessary, to load any translated strings for the plugin. Doing so allows you to use the various translate functions such as __( ‘Some text’, ‘wc_helloworld’ ) and easily provide translation files at some future date.

   load_plugin_textdomain( 'wc_helloworld', false, dirname( plugin_basename( __FILE__ ) ) . '/' );

I prefer to define the bulk of my plugin functions within a class, which effectively scopes the functions you write and keeps you from having to worry about function name clashes with all the other WordPress core and plugin functions. There are a few commonly used lifecycle action hooks which will be included in our skeleton plugin class. Finally, the plugin class will be instantiated, assuming that WooCommerce is active, and the class name isn’t already taken.

class WC_Helloworld {

      public function __construct() {
        // called just before the woocommerce template functions are included
        add_action( 'init', array( $this, 'include_template_functions' ), 20 );

        // called only after woocommerce has finished loading
        add_action( 'woocommerce_init', array( $this, 'woocommerce_loaded' ) );

        // called after all plugins have loaded
        add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );

        // indicates we are running the admin
        if ( is_admin() ) {
          // ...

        // indicates we are being served over ssl
        if ( is_ssl() ) {
          // ...

        // take care of anything else that needs to be done immediately upon plugin instantiation, here in the constructor

       * Override any of the template functions from woocommerce/woocommerce-template.php
       * with our own template functions file

      public function include_template_functions() {
        include( 'woocommerce-template.php' );

       * Take care of anything that needs woocommerce to be loaded.
       * For instance, if you need access to the $woocommerce global

      public function woocommerce_loaded() {
        // ...

       * Take care of anything that needs all plugins to be loaded

      public function plugins_loaded() {
        // ...

    // finally instantiate our plugin class and add it to the set of globals

    $GLOBALS['wc_helloworld'] = new WC_Helloworld();

Furthermore, if you were already familiar with WordPress/WooCommerce development there probably wasn’t much new for you here, but hopefully, if you’re new to the game then the above explanations and techniques will prove helpful in getting you started. Either way, the best way to learn the multitude of WooCommerce actions and filters available for customization is to browse the source code. Also remember that in addition to hooking into actions/filters and adding functionality, you can just as easily unhook existing actions/filters to remove plugin behavior, or change it wholesale. The trick is to perform the remove_action()/remove_filter() calls after the target action is hooked to (for instance within our woocommerce_loaded() function above), and to always remember to provide all the arguments to the remove functions that were passed in the add functions, optional parameters and all.

That’s it from this article. I strongly believe there is always room for improvement. So I am open to any suggestion and feedback. Please feel free to leave what you are thinking in the comments section below. Cheers.

Author: Qaisar Satti
Category: Woo Commerce
Last Modified: August 1, 2019

WooCommerce Introduction important knowledge you must have

This is an WooCommerce introduction tutorial. Woocommerce is a free plugin that transforms WordPress websites into customizable eCommerce stores. With more than 48 million downloads, WooCommerce powers over 28% of all eCommerce sites.

eCommerce Comparison: Choose the Right Platform For Your Business
There are lots of eCommerce options to choose from, including several established platforms. Here’s how to select a platform best suited for your business.

Hosting, Security,Updates for WooCommerce

Large open-source platforms like WooCommerce and Magento — and smaller ones such as OpenCart and ZenCart — are flexible enough to work with most hosts. Not all website hosting companies offer the best experience for larger eCommerce sites, so it’s worth doing research.

Woo Commerce Pricing: How Much Does it Cost to Run a Store?

Woo Commerce and WordPress are both free, open source software. While this can represent considerable savings when it comes to Woo Commerce pricing, there are still some costs involved in launching a new store.

Latest version:
Woo Commerce 3.0 has arrived – read on to learn what’s new.

The Woo Commerce 3.0 release, which includes:

  • An updated product gallery with new zoom, gallery view and mobile features
  • Multiple speed and performance improvements
  • The addition of CRUD classes
  • A new CLI powered by the REST API
  • Why this release is 3.0 instead of 2.7

As you may have seen in emails or chatter online, this release was originally planned to be numbered as 2.7, and released in mid-March. But plans changed in the process of beta testing, and it was felt that it was time to move to a new release system.

Moving forward, WooCommerce releases will use Semantic Versioning, which dictates that major releases — those with API changes or the potential to affect extension compatibility, like this one — receive a new major version number (ex. 4.0, 5.0). Minor releases and patches, on the other hand, will receive point versions (ex. 3.1, 3.2).

Furthermore this method is an attempt to better describe what each release contains, and tell you at a glance how much of a potential impact a release might have on your store. I hope this also increases confidence in minor releases and patches, and helps users to update WooCommerce more quickly when one of these updates are released.

Additionally, moving forward,the woocommerce community tends to add more time for beta version and release candidate testing after new major versions are announced. This is due to helpful feedback received 2.7 release post from developers who wanted more time to test.

Since this tutorial is for the sake of information and update, So that is pretty much it for now.I hope it serves the purpose.Furthermore please feel free to drop any suggestions or queries in comments section. That will definitely be highly appreciated.

Author: Qaisar Satti
Category: Woo Commerce
Last Modified: August 1, 2019

PrestaShop Canvas Module

This tutorial is about PrestaShop Canvas Module . This is a quite useful piece of code and a very important one too. let’s move forward and have a look.

First Step:

Create a directory as the same name as your module name in the following directory.


In my case, my module name is helloworld so directory name will be helloworld. The directory structure will look like.


Second Step

Now we create file name helloworld.php in the following location. You module directory name and file name must be same.


The file contains following code.


if (!defined('_PS_VERSION_'))

class Helloworld extends Module
  private $errors = null;
  public function __construct()
    // Author of the module
    $this->author = 'qaisarsatti';
    // Name of the module ; the same that the directory and the module ClassName
    $this->name = 'helloworld';
    // Tab where it's the module (administration, front_office_features, ...)
    $this->tab = 'others';
    // Current version of the module
    $this->version = '1.0.0';
    //  Min version of PrestaShop wich the module can be install
    $this->ps_versions_compliancy['min'] = '1.5';
    // Max version of PrestaShop wich the module can be install
    $this->ps_versions_compliancy['max'] = '1.7';
    // OR $this->ps_versions_compliancy = array('min' => '1.5', 'max' => '1.6');
    //  The need_instance flag indicates whether to load the module's class when displaying the "Modules" page
    //  in the back-office. If set at 0, the module will not be loaded, and therefore will spend less resources
    //  to generate the page module. If your modules needs to display a warning message in the "Modules" page,
    //  then you must set this attribute to 1.
    $this->need_instance = 0;
    // Modules needed for install
    $this->dependencies = array();
    // e.g. $this->dependencies = array('blockcart', 'blockcms');
    // Limited country
    $this->limited_countries = array();
    // e.g. $this->limited_countries = array('fr', 'us');
    // Name in the modules list
    $this->displayName = $this->l('Example');
    // A little description of the module
    $this->description = $this->l('Module Example');
    // Message show when you wan to delete the module
    $this->confirmUninstall = $this->l('Are you sure you want to delete this module ?');
    if ($this->active && Configuration::get('EXAMPLE_CONF') == '')
      $this->warning = $this->l('You have to configure your module');
    $this->errors = array();

So, that’s it from this tutorial. I strongly believe there is always room for improvement. So I am open for any suggestion and feedback. Please feel free to leave hat you are thinking in the comments section below. Cheers.

Author: Qaisar Satti
Category: Prestashop
Last Modified: July 26, 2019

PrestaShop introduction – Know PrestaShop

This tutorial is about PrestaShop introduction.I will try to share the basic knowledge here.Prestashop is an open source e-commerce solution. It comes with a variety of tools necessary for building a successful online shop. 

I am not going to go in detail but I will share the steps which you can follow to have the knowledge and know how of prestatshop. Also will briefly explain one or two steps here.

 How to install PrestaShop

  • Manage Products and Categories
  • Configuring PrestaShop
  • Managing your store in PrestaShop
  • Additional PrestaShop tutorials


The purpose of this tutorial is to show you how to install a PrestaShop e-commerce platform on your site via the Softaculous auto installer. One of the great things about Softaculous is that it allows you to setup applications really fast. You don’t need to go through all steps manually and with just several clicks you will have a fully functional PrestaShop on your account.
First, you need to access your cPanel account and find the Softaculous icon which is under the Software/Services section.

The next step is to click on the Softaculous icon. You will be redirected to a new page which is the auto installer’s control panel. From here you can install new apps, create backups, import existing websites, etc. On the left side of the screen is the categories menu. To proceed with the PrestaShop installation find the E-Commerce section and click on it to expand. You will see a list of applications that you can install. Find the PrestaShop link and click on it, so that Softaculous will open the installation screen.

The newly loaded page provides a brief description of the PrestaShop application and its features. You can also read a review of the platform and rate it. Click on the blue Install button.

This is the most important step at which you need to provide more details about the new PrestaShop website. Some of the fields are automatically filled by Softaculous for your convenience. However, we strongly advise you to review the values of the following crucial configuration parameters:

In Directory – please note that by default Softaculous will install the PrestaShop application in the root web folder and you will be able to access the website via your domain name. If you prefer to install it in a subfolder, for example, shop, enter its name in the In Directory field.

Store Name – this is the name of your website and by default, it is set to My Store. You can change it to something that better describes the main purpose of your new website.

Admin Folder – you can change it to a random string. Adding it to the web site’s URL will load the admin section.

Admin Email – by default, this field is set to admin@yourdomainname.com, where instead of yourdomainname.com your actual domain is entered. If you want, you can change it to a different e-mail account.
Admin Password – Softaculous automatically generates a unique password for your new website. Still, you can change the string in the field and type a new password which you can remember more easily.

The last step is to scroll down to the end of the page and click on the Install button.
That’s it! Your PrestaShop application is installed and ready to use. The installer will redirect you to a new page where you will see the details for the completed installation. You can now login and create your PrestaShop website.

Key Features:

The key features provided by the platform are structured in two major groups.
The first one is the “Front Office” which is the place where your customers will find all of the available products and where they will be interacting with your Online Store purchasing your products. The features included in this group are:

Featured Products

  • Product – image zoom
  • Customer subscriptions and the creation of customer accounts
  • Large amount of supported payment methods
  • Google Checkout integration
  • RSS feeds
  • Newsletters

The second major group is more important for the Store Owners as it is related to the backend (Back-Office) of their Online Stores as there is the place where all of the adjustments and store modifications are made. The features included in that group are:

  • WYSIWIG text editor for basically all of the text fields related to your products
  • Unlimited amount of product categories and subcategories
  • Large amount of supported currencies and taxes which you can configure all on your own
  • SMS/Text Message module
  • Customizable notifications for the delivery status of the product
  • SEO Friendly URL configuration
  • Full SSL support
  • Smarty templating engine

Certainly, these are only a few of the unlimited amount of features offered by the platform which means that you will be able to find every type of feature you will need for the successful start and development of your Online Store.

That’s it from this tutorial. I hope it serves the purpose. Furthermore please feel free to drop any suggestions or queries in the comments section. That will definitely be highly appreciated.

Author: Qaisar Satti
Category: Prestashop
Last Modified: July 26, 2019

PrestaShop reset admin password

This tutorial is about Prestashop-Reset admin password.In this article, we will learn how to install a reset admin password in prestaShop.Often people forget their passwords and find it difficult to reset them. It is quite a simple process. So let’s move forward and have a look.

Please note that this method will be useful only when you have access to the database.

First of all check your ”config/settings.inc.php ” file for the _COOKIE_KEY_ value.

Run the following SQL and replace the <> variables with your information:

UPDATE employee SET passwd = md5(“<_COOKIE_KEY_ value>”) WHERE email = “youremailaddress”;

Let’s have an example for more clarification.

UPDATE `ps_employee` SET `passwd` = MD5(‘<_COOKIE_>password’) WHERE `email` = ‘info@qaisarsatti.com’;

That’s it from this simple method. That’s it from this tutorial. I strongly believe there is always room for improvement. So I am open to any suggestion and feedback. Please feel free to leave what you are thinking in the comments section below. Cheers.

Author: Qaisar Satti
Category: Prestashop
Last Modified: July 26, 2019

PrestaShop Installation

This tutorial is about Prestashop Installation . Often people face little bit of trouble while installing Prestashop.In this article we will learn how to install prestashop. So here, we will discuss particularly about prestashop installation on any system. It is quite a simple process.We will discuss one or two methods here.So lets move forward and have a look.

We will follow the simple steps,discussed below.

Installation Steps

1) Download prestashop from

2) extract zip file and you get a folder with name “prestashop”

3) After extracting zip file
a) If you are using wamp then copy the “prestashop” and paste in to www folder.
b) If you are using xampp then put into “htdocs” folder.
c) If you use filezilla then upload “prestashop” into “public_html” folder.

Now start wamp or xamp

and open the browser and type “localhost/prestashop”, After opening installation page, follow these steps:

Below are the Five steps needed for installation.

1st) choose your language and accept the conditions.

2nd ) PrestaShop will check system Compatibility

If system Compatibility is valid then click on next button, after clicking on next button prestaShop will check system configurations.

3rd)Fill in your database details and then click on verify.

Similarly, if all the information is correct then a message showing database connected will be shown.

Furthermore click on next button.

4th)Fill in the information like user name(use for admin login) , password(use for admin login) etc and click on next button.

The progress bar will show the installation status and after finishing installation, go to “prestashop” folder saved in www folder in wamp and delete installation file and rename admin folder according to your needs.These are the simple steps to install PrestaShop.

That’s it from this tutorial. I strongly believe there is always room for improvement.So i am open for any suggestion and feed back. Please feel free to leave what you are thinking in the comments section below. Cheers.

Author: Qaisar Satti
Category: Prestashop
Last Modified: July 26, 2019

Magento 2 logging

Today we will be talking about how to work with Magento 2 log. There is a different type of log you can log with Magento 2. For example debug log, information log, and other logs too. so let start with our log type.

A simple example of how to inject the logger class.

protected $logger;
public function __construct(\Psr\Log\LoggerInterface $logger)
    $this->logger = $logger;

Debug Log Method


log location: var/log/system.log

Info Log Method


log location: var/log/exception.log

Notice Log Method


log location: var/log/exception.log

Error Log Method


log location: var/log/exception.log

Critical or Exception Log Method


log location: var/log/exception.log

Author: Qaisar Satti
Category: Magento 2
Last Modified: July 26, 2019