Home › Forums › WoodMart support forum › Shop Category Ajax Not Working after 5.6 update and Woocommerce Update
Shop Category Ajax Not Working after 5.6 update and Woocommerce Update
- This topic has 9 replies, 3 voices, and was last updated 4 years, 5 months ago by
Artem Temos.
-
AuthorPosts
-
December 10, 2020 at 7:21 pm #249718
MasterParticipantHi,
I have just noticed that the sidebar category ajax loading is not working anymore. Before, when clicked on the category it would load the category by ajax, now it is not working anymore.
December 10, 2020 at 8:56 pm #249758
Elise NoromitMemberHello,
Please deactivate all the plugins not related to the theme and switch the parent theme, check the issue, If the problem has gone, activate the plugins one by one, checking the issue to detect which one causes the problem.
Best Regards
December 11, 2020 at 5:57 am #249821
MasterParticipantHi,
wordpress v5.6.0
woocommerce v4.8.0I have deactivated all the plugins except woocommerce and switched to parent theme, the product categories widget is not loading with ajax anymore.
I have disabled then enabled the AJAX shop under theme settings to test if maybe that might be the problem but still not working.
Version 5.6 updated to the latest jquery and jquery migrate, it also had a database update, but I think it is a jquery issue.
From the console log:
jquery.pjax.min.js?ver=5.3.3:1 Uncaught cant get selector for pjax container!
q @ jquery.pjax.min.js?ver=5.3.3:1
p @ jquery.pjax.min.js?ver=5.3.3:1
(anonymous) @ jquery.pjax.min.js?ver=5.3.3:1
dispatch @ jquery.min.js?ver=3.5.1:2
v.handle @ jquery.min.js?ver=3.5.1:2December 11, 2020 at 7:51 am #249870
MasterParticipantHi, I tested it out, again this code makes trouble and I don’t know why. When I disable this code ajax is working fine. Somewhere in your theme you might be comparing versions or scripts and as soon this code is active sidebar category ajax stops working.
add_filter( ‘style_loader_src’, ‘mydomain_remove_scripts_styles_src’, 10, 2 );
add_filter( ‘script_loader_src’, ‘mydomain_remove_scripts_styles_src’, 10, 2 );function mydomain_remove_scripts_styles_src( $src, $handle ) {
$src = remove_query_arg( ‘ver’, $src );
return $src;
}December 11, 2020 at 10:45 am #249921
Artem TemosKeymasterSorry, but this code is not related to our theme and we don’t know why it causes the error. Fixing third-party codes is out of our theme support scope.
December 11, 2020 at 6:19 pm #250140
MasterParticipantHi Artem,
This code actually is very related to your theme, I am a developer too, I have made many wp themes and plugins and this simple code did not break any of them yet until now. You are selling a woocommerce theme which is an online store, for an online store security is base for business. As you might know, there are automatic bots scaning websites especially wordpress for version numbers and saving them for later attack as it was with wordpress API vulnerability and many websites had been target and many got hacked.
This simple code removes the version number from all scripts and styles, at least you could tell me where I have to look for, you should know as a developer where the problem might exist, I did not ask for a solution, at least you could point me to the right direction. I am bit disappointed.
Thanks Artem anyways.
December 12, 2020 at 10:36 am #250286
Artem TemosKeymasterHello,
Could you please send us a link to the page where you have a problem with this code? Also, make sure that you are running the latest version of the theme 5.3.6.
Kind Regards
December 12, 2020 at 5:05 pm #250389
MasterParticipantHi,
The version 5.3.6 fixed the issue with the code and ajax, thank you a lot, great job.
Thanks.
December 12, 2020 at 6:28 pm #250397
MasterParticipantIf somebody else is reading this and you have see some unwanted cache problems with the above code snippet you can use this code instead.
add_filter(‘script_loader_src’, ‘mydomain_remove_scripts_styles_ver’, 10, 2);
add_filter(‘style_loader_src’, ‘mydomain_remove_scripts_styles_ver’, 10, 2);function mydomain_remove_scripts_styles_ver( $src, $handle )
{
$parsed_src = parse_url( $src, PHP_URL_QUERY );
// $src = remove_query_arg( ‘ver’, $src );
parse_str( $parsed_src, $query_args );
if ( isset( $query_args[ ‘ver’ ] ) ) {
$salt = ‘yoursalt’;
$hashed = substr( sha1( $query_args[‘ver’] . $salt ), 0, 5 );
$src = add_query_arg( [ ‘ver’ => $hashed ], $src );
}return $src;
}This topic can be closed, thanks again for the great work team.
December 14, 2020 at 6:54 am #250697
Artem TemosKeymasterGreat, we are glad that you sorted it out. Feel free to contact us if you have any questions.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register