How to override theme javascript

In this tutorial you will learn how to override a theme javascript function from the znscript.js file.


  • Good knowledge of Javascript code language
  • A child theme for theme activated

How to:

  • Open the /js/zn_script_child.js file from THEME-child theme
  • Add the following javascript code :
(function ($) {
    jQuery.ZnThemeJs.prototype.FUNCTION_NAME_YOU_WANT_TO_OVERRIDE = function(scope) {
        // Your Javascript code here

Please note that by doing this, you will override the whole function from the master theme. In case that a fix is made in the master theme and you override the function from the child theme, you won’t get the fix unless you manually update your function.