Plugin Contributor
royho
(@royho)
It doesn’t look like you apply the changes from the link correctly as I can see it is not reflected on your site. Are you using the custom code the plugin to do it? If you were using custom code, I suggest you undo that and simply use the plugin on that page.
Thanks royho but whether or not the patch is installed the result is the same. We’ve taken the patch off because it didn’t do anything – which makes sense because if you look at the network tab ‘jquery.cookie.min.js’ loads just fine. I think that fix was just for installations that prevented that file from loading.
Plugin Contributor
royho
(@royho)
@ukeboyska – please post on your own thread.
thanks @royho but i’m green city grower’s wordpress developer…my co-worker started the thread.
Plugin Contributor
royho
(@royho)
Please install the plugin and remove the custom code. Once you do that, let me know and I will check your site again. As of now, you can see nothing has changed on your site.
@royho as you wish. i’ve activated the plugin. and there is/was no custom code.
Plugin Contributor
royho
(@royho)
@ukeboyska – ok now try deactivating all plugins except WooCommerce and switch to 2015 theme and re-test.
@royho okay — i switched themes and kept plugins, and it worked fine. i switched back quickly because the other theme completely screws up the rest of our site.
@royho – if it helps here is the JS part of my functions file. including the ajaxform file here fixed half of the issues i was having the woocommerce and JS. app.main.js includes my own version jquery. i’m using a build system to compile all my JS into 1 file.
// register scripts
if (!is_admin()) {
wp_deregister_script(‘jquery’);
// global scripts
wp_register_script(‘greencitygrowers’, get_bloginfo(‘template_url’).’/dist/+assets/scripts/app.main.js’, false, false, true);
wp_enqueue_script(‘greencitygrowers’);
wp_register_script(‘ajaxform’, get_bloginfo(‘template_url’).’/dist/+assets/scripts/vendor/ajaxform.js’, false, false, true);
wp_enqueue_script(‘ajaxform’);
wp_register_style( ‘screen’, get_bloginfo(‘template_url’).’/dist/+assets/styles/main.css’, false, ‘1.0’, ‘screen’ );
wp_enqueue_style( ‘screen’ );
}
Plugin Contributor
royho
(@royho)
Ok why do you need to include your own jQuery? That is a very bad practice.
i fundamentally disagree. from the perspective of someone who makes custom themes it’s very bad practice for wordpress to update jquery automatically. maybe you have dependencies and when you update wordpress your whole site breaks.
i’ve been using this method for a long time. woocommerce is the first plugin i’ve come across that i’ve had these kinds of issues with.
however i’m just now seeing that jquery gets included in my pages anyway, regardless of my deregister script function. perhaps this is the root of the issue?
Plugin Contributor
royho
(@royho)
WordPress is the platform in which you’re building for so utilizing what WordPress use as the jQuery version is the correct way to go. If you roll your own, one day either your version gets too old or it is too new which can break all sorts of stuff. I highly suggest you do not do this.
Also now that I know you’re trying to encompass all the JS scripts into one, there could be many different cases where things could go wrong so try letting them load separately and see if that works. This way you can find out right away if it is your build script or a separate script that is causing your issue.
Plugin Contributor
royho
(@royho)
To shed some light on why not to load your own jQuery. Here is a post with good explanation https://pippinsplugins.com/why-loading-your-own-jquery-is-irresponsible/
@royho thanks for the suggestion but i’m not going to change my philosophy on this overnight. i’ll update jquery manually when i need to. i don’t like wordpress dictating what i should do on the frontend when i’m only using it as a backend platform.
i’ll give separating scripts a shot and i’ll see where that takes me. please let me know if you think of anything else, thanks!
for anyone else who refuses to let wordpress dictate your front end, this was the fix:
add_filter(‘wp_enqueue_scripts’, ‘override_enqueue_scripts’, 10);
function override_enqueue_scripts() {
//enqueue your JS here
wp_enqueue_script(‘greencitygrowers’);
wp_enqueue_script(‘ajaxform’);
}
the priority argument (10) essentially tells wordpress to ignore woocommerce’s registration of jquery so that everyone gets to play nice with each other.