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

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #249718

    Master
    Participant

    Hi,

    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.

    #249758

    Hello,

    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

    #249821

    Master
    Participant

    Hi,

    wordpress v5.6.0
    woocommerce v4.8.0

    I 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:2

    #249870

    Master
    Participant

    Hi, 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;
    }

    #249921

    Artem Temos
    Keymaster

    Sorry, 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.

    #250140

    Master
    Participant

    Hi 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.

    #250286

    Artem Temos
    Keymaster

    Hello,

    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

    #250389

    Master
    Participant

    Hi,

    The version 5.3.6 fixed the issue with the code and ajax, thank you a lot, great job.

    Thanks.

    #250397

    Master
    Participant

    If 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.

    #250697

    Artem Temos
    Keymaster

    Great, we are glad that you sorted it out. Feel free to contact us if you have any questions.

Viewing 10 posts - 1 through 10 (of 10 total)