• Resolved dansart

    (@dansart)


    Hi there
    I get the message that select2 is missing.
    Newest WordPress, Woocommerce and Plugin Version.

    I’ve tried to add it like so.
    This does not work, only when I set the handle (first parameter of the wp_enqueue_script) to “select2-js” the script gets loaded, but is still shown as missing.

    add_action('wp_enqueue_scripts', 
    function(){
    wp_enqueue_script('select2', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js', ['jquery'], '4.0.13', TRUE);
    }
    , 1);
    QueryMonitor screenshot
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author ThemeHigh

    (@themehigh)

    Could you please check after adding the below code snippet in your child theme’s functions.php file to include ‘selectWoo’ in another name.?

    function th34r_enqueue_custom_scripts($hook) {
    	if(is_checkout()){
    		wp_register_script( 'selectWoo2', plugins_url() . '/woocommerce/assets/js/selectWoo/selectWoo.full.js', array( 'jquery' ), '1.0.0', false );
    		wp_enqueue_script( 'selectWoo2' );
    		wp_enqueue_style( 'select2');		
    	}
    }
    add_action('wp_enqueue_scripts', 'th34r_enqueue_custom_scripts', 10);
    add_filter('thwcfe_public_script_deps', 'th34er_public_script_deps', 99);
    function th34er_public_script_deps($deps){
    	if(is_checkout()){
    		$key = array_search('selectWoo', $deps); 
    		unset($deps[$key]);
    	}
    	return $deps;
    }

    Could you please check and verify if this works for you?

    Thank you!

    Thread Starter dansart

    (@dansart)

    Hi
    The new script gets loaded, but the error is still showing up.
    Do you know, why

    wp_register_script( 'select2', plugins_url() . '/woocommerce/assets/js/selectWoo/selectWoo.full.js', array( 'jquery' ), '1.0.0', false );
    wp_enqueue_script( 'select2' );

    does not work? Only when I change the name of the handle, the script gets embedded.

    Plugin Author ThemeHigh

    (@themehigh)

    Your issue needs a detailed check. Can you please raise a ticket through our website? We hope our technical team will be able to help you.

    Thank you!

    Plugin Author ThemeHigh

    (@themehigh)

    Since we haven’t heard back from you, we believe that your issue is resolved.

    We are going to mark this thread as resolved.

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘select2 dependency not found’ is closed to new replies.