Posted on

WooCommerce – How to show savings in an onsale product instead of “sale”?

If you have your product on sale, sometimes you’d like to show the savings from that sale instead of just the sale badge. The following code snippet would allow you to do just that.

Please note that in variable product, it tries to show the maximum savings possible. So it is advised to add “upto” in the sale badge.

Default WooCommerce just shows the sale badge like above.
Now you can show the savings instead of just the sale badge.

The custom code is given below. Please paste the code below in your child theme’s functions.php, please make sure to copy from line 2 only.

Custom code to show savings instead of sale. You can pass ‘amount’ or ‘percentage’ on line 86. Please copy from line 2 only.
Posted on

WooCommerce – Remove h2 tag from product title

In product loop pages like shop and category pages, the product title is displayed within h2 tags. You can use this code snippet to change the h2 tag to a span tag. You can also modify the code to use any other tag instead of the span tag.

Since WooCommerce does not have a filter for the function that displays the WooCommerce loop product title, we’ll be overriding the core function itself. woocommerce_template_loop_product_title is the WooCommerce’s core function and we are overriding it like below:

Please paste the above code in your theme’s functions.php to remove the h2 tag from product title. Copy from line 2 only.
Posted on

How to update a themeforest wordpress theme or a codecanyon wordpress plugin?

Themeforest from Envato is one of the most popular websites for buying WordPress themes and plugins ( Disclaimer : I sell WordPress WooCommerce themes via Themeforest ). If you had purchased a WordPress theme or a plugin from Themeforest you are entitled to receive unlimited updates as long as the theme or plugin author provides it. In this post I’ll explain how to automatically update a wordpress theme or a wordpress plugin purchased from Themeforest.

Step 1 : Installing Envato Market WordPress Plugin

Envato Market plugin developed by Envato is a wordpress plugin that allows you to install/update wordpress themes and plugins purchased from Envato. It connects with Envato API using secure oAuth personal token. The plugin though is not available in It should be downloaded from here :

Warning : You should not download this plugin from Envato’s git repository

Once you’ve downloaded the file from the above URL, you should navigate to your Plugins page in your WP admin dashboard to upload, install and activate the plugin. On activation, you will find Envato Market menu in your admin dashboard which should take you to the Envato Market plugin page. The plugin page looks like this :

Step 2 : Generate a personal token

In the Envato Market plugin page, you will have to click on “generate a personal token” link. This will take you to website to generate the token. You will have to give it a name ( it is arbitrary ) and the permissions for this token. It is important to keep the “View and search Envato sites“, “Download your purchased Items”, “List purchases you’ve made”, “Verify purchases you’ve made” permission checked. It looks likes this :

Once you’ve clicked on “Create Token”, it generates a token for you. You should copy it and paste it within the “Token” field in the Envato Market plugin page.

Step 3 : Update the theme/plugin

Once you’ve “Save Changes”, you should now see all your wordpress themes and plugins listed. Here is a sample screenshot

You can see the plugin will notify you if there are updates available. You can simply click on the “Update Available” to update the theme or plugin.

Posted on

Disable product gallery zoom in WooCommerce 3.0+

Product Gallery in Electro WooCommerce Theme

WooCommerce 3.0 was a major release and it included a complete overhaul of Product Image gallery. The new gallery had advanced features like image zoom, mobile features and gallery view. Product zoom is a necessary feature for products that are more detailed in nature. For other type of products, its unnecessary and many users would like to disable it.

To disable the product gallery zoom please add the code snippet given below into your child theme’s functions.php :

Posted on

WooCommerce – Change currency sign/symbol of UAE Dirham

The Problem

When you set the currency in WooCommerce Settings to United Arab Emirates Dirham it looks like this :

While it is correct to use د.إ which stands for Emirati Dirham as the currency sign, it is not commonly used in websites that are in English where AED is used instead. So we need to change the currency sign from د.إ to AED.

The Solution

Luckily WooCommerce has filters that allows us to override the default values for currency symbol. Pasting this code in your theme’s functions.php ( It is recommended to use a child theme always for customisations ) will change the currency symbol of UAE Dirham to AED :