Home › Forums › WoodMart support forum › permanent changes / overwrite in a woodmart .js file, possible? › Reply To: permanent changes / overwrite in a woodmart .js file, possible?
July 14, 2021 at 3:35 pm
#306698
iwanwilaga
Participant
It seems workin’, but with a slight modification:
I found that the script handler must be wd-add-to-cart-all-types
instead of add-to-cart-all-types
. Somewhere you add the wd- prefix at script registration apparently.
so this works for me by now:
function override_woodmart_theme_scripts() {
global $wp_scripts;
$wp_scripts->registered['wd-add-to-cart-all-types']->src = get_stylesheet_directory_uri() . '/js/scripts/wc/addToCartAllTypes.js';
}
add_action('wp_enqueue_scripts', 'override_woodmart_theme_scripts', 21); // under '21' priority it threw fatal error to me.
Best wishes,
Wiktor