• I am using Avada Theme. Clover checkout credit card fields not displaying. Console error shows jquery error. anyone have a fix for this?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Their JS code uses jQuery, however it does not list that as a dependency in wp_register_script.

    You can use the following snippet to dequeue their JS, and then enqueue it later, in the footer for example. You may need to play with the priority to make it work in your install.

    
    /**
    * Clover Plugin Patch
    * make sure JS gets loaded after jQuery
    *
    */
    
    add_action( 'wp_enqueue_scripts', function() {
       wp_dequeue_script( 'custom_scripts' );
    }, 11 );
    
    /**
     * I load jQuery in the footer, so the priority here is an   
     * experiment, based on your implementation.
     */
    add_action( 'wp_footer', function() { 
       wp_enqueue_script( 'custom_scripts' );
    }, 1 );

    The Real Fix is Simple:

    The developer needs to change line 356 in class-woo-clv-admin.php to read:

    wp_register_script('custom_scripts', plugins_url('../public/js/woo-clv-custom.js', __FILE__), array('jquery', 'clover_js'), '1.0.0', false);

    It’s as simple as adding jQuery to the list of dependencies in the enqueue code. Actually a rookie error; hard to believe this made it through QA.

Viewing 1 replies (of 1 total)
  • The topic ‘jquery error’ is closed to new replies.