Home Forums WoodMart support forum Using Woodmart Ajax technology causes the menu not to close

Using Woodmart Ajax technology causes the menu not to close

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

    ha21cn
    Participant

    I used Html Block to build Mega Menu, and at the same time turned on Woodmart’s Ajax function, but now I found a problem, when I clicked on the categories in Mega Menu, although the page content will be refreshed, Mega Menu will not be closed, and the menu will be closed only when Ajax is turned off, is there any way to solve this problem? Is there any way to solve this problem? While keeping the Ajax function?
    https://drive.google.com/file/d/1sqrkXSW66s-hJJgUXpzyfeQ9q00ZSU-6/view?usp=drive_link
    This is a video of me clicking through the menu.

    #670467

    Luke Nielsen
    Keymaster

    Hello,

    I would like to request temporary admin access so I can look at the settings there better.

    Thank you for your time.

    Kind Regards

    #670540

    ha21cn
    Participant

    The account and password are provided below.

    #670596

    Luke Nielsen
    Keymaster

    Unfortunately, we don’t have such functionality to close the dropdown during AJAX requests. In this case, we can offer you the following code that will disable AJAX when you click on a category.

    add_filter('woodmart_ajax_links', function () {
    	return '.wd-nav-product-cat a, .wd-page-wrapper .widget_product_categories a, .widget_layered_nav_filters a, .woocommerce-widget-layered-nav a, .filters-area:not(.custom-content) a, body.post-type-archive-product:not(.woocommerce-account) .woocommerce-pagination a, body.tax-product_cat:not(.woocommerce-account) .woocommerce-pagination a, .wd-shop-tools a:not([rel="v:url"]), .woodmart-woocommerce-layered-nav a, .woodmart-price-filter a, .wd-clear-filters a, .woodmart-woocommerce-sort-by a, .woocommerce-widget-layered-nav-list a, .wd-widget-stock-status a, .widget_nav_mega_menu a, .wd-products-shop-view a, .wd-products-per-page a, body[class*="tax-pa_"] .woocommerce-pagination a';
    });

    Kind Regards

    #670618

    ha21cn
    Participant

    However, this menu was created using your built-in functionality, and the menu data is very large. Without Ajax functionality, it will cause the website to load very slowly. Do you have any other methods to cache this menu? This would improve the website’s loading speed.

    #670671

    Luke Nielsen
    Keymaster

    This specific use of AJAX functionality with product categories was not intended from the beginning, since AJAX is not designed for situations where regular links are used in dropdown menus (for example, in Mega Menu). In such cases, clicking on an element should lead to a complete page transition, not partial content updates — that’s exactly why conflicts arise with menu behavior that remains open. So currently, it’s not possible to change it.

    Kind Regards

    #671320

    ha21cn
    Participant

    https://ibb.co/pjxvcQw8
    When I use Google Chrome’s DevTool to analyse a website, it says [Intervention] Slow network is detected. See https://www.chromestatus.com/feature/5636954674692096 for more details. Fallback font will be used while loading: https://clubshopjerserys .com/wp-content/themes/woodmart/fonts/woodmart-font-1-400.woff2?v=8.2.5, I think it is because of the font loading that the site is slowing down, how do I disable the use of Woodmart fonts?

    #671495

    Luke Nielsen
    Keymaster

    Enable the “Swap” option for the font in Theme Settings -> Performance: https://take.ms/z8vQk

    Kind Regards

    #673603

    ha21cn
    Participant

    I would like to confirm where the code to turn off the Ajax function is placed above?

    #673712

    Luke Nielsen
    Keymaster

    Hello,

    Disable it in the settings of the menu item: https://take.ms/KUBWm

    Kind Regards

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