if you are getting Uncaught ReferenceError: wc_add_to_cart_params is not defined.
then
If it is a external js file then enqueue it in footer.
function enqueue_custom_script_in_footer() {
wp_enqueue_script(
'custom-banner-script', // Handle of the script
get_template_directory_uri() . '/js/custom-banner.js', // Path to your JS file
array('jquery'), // Dependencies (e.g., jQuery)
null, // Version number (optional, null uses the theme version or file modification time)
true // Load in footer (true = yes, false = no)
);
}
add_action('wp_enqueue_scripts', 'enqueue_custom_script_in_footer');