Override plugin's variable.php file with your theme's variable.php file.


Posted on 29-08-2018 02:27AM


To override plugin’s variable.php with your theme’s variable.php.copy/paste variable.php file from plugins woocommerce/single-product/add-to-cart to somewhere in your theme and then you will need some code in your theme’s functions.php file that replaces theme’s variable.php file as default variable template. Here is such sample code. Replace the/path/of/your/plugin/variable.php with the path of your theme’s variable.php.

 

 

 if (strstr($template, 'variable.php')) {
        $template = ''.get_template_directory().'/variable.php';
    }
 
    return $template;
}

add_action( 'woocommerce_locate_template', 'use_theme_variable_template', 10, 3 );

 

Here we are assuming that Variable.php file is located inside root folder of the plugin.