Posts

Best WooCommerce Customization Practices

Image
In this post I am going to share the best WooCommerce customization practices. The greatest benefits of WooCommerce is its flexibility, code and content can be changed to suit the store. There are hundreds of plugins available to add new functionalities. Never edit the core WooCommerce plugin code, when a new plugin update is available. After updating you will lose all the customization done. There are two best WooCommerce customization practices to follow when making site tweaks. Theme Plugin Using a Child Theme If you want to modify the CSS, then the best option is to use a child theme to preserve customizations against future WooCommerce updates. There are two ways with which you can customize. WooCommerce Template in child Theme:- Create “woocommerce” directory within child theme and add same directory structure as in WooCommerce Core. Add template file to it and do required customization. This will override the core template and any modification after plugin update will not effe...

WooCommerce Hooks Actions & Filters

Image
In this post I’m going to show how to use WooCommerce Hooks actions & filters for core plugin customization.  Hooks are of two types Action and Filter. Hooks are snippets of code that can be placed into your WordPress theme’s functions.php file or even added into a custom plugin. Action Hooks Action hooks are triggered when an event takes place, such as a user logged in or a custom action that you define in your theme or plugin.   We can create our own custom action hooks within plugin or theme using do_action() function. The function hooked to that action will run at that point in the code.   Filter Hooks Filter Hooks are used to modify data at runtime. The main difference between Action and Filter hook is, Filter Hook always returns a modified data value while Action Hook just triggers the code at that point in the code.   The apply_filter() functions apply filter to the the existing code. Later we can modify that code via add_filter() function. For WooCommerc...