Support » Plugin: WooCommerce Menu Cart » Bug in wpmenucart-ajax-assist.js

  • Resolved James Collins

    (@jamescollins)


    Hi there,

    We’ve been noticing issues with the menu cart contents showing a different number of items than what is in the cart on a site hosted on WP Engine (ie with full page caching, and I’ve come across a bug in your wpmenucart-ajax-assist.js file.

    I was debugging the JS code, and noticed that the wpmenucart_ajax_assist.shop_plugin setting was being set to “woocommerce” (ie lower case), which means that the if statement on line 4 wasn’t evaluating properly because the if check is looking for “WooCommerce” instead.

    Line 4 in that file is:
    `
    if (wpmenucart_ajax_assist.shop_plugin == ‘WooCommerce’ || wpmenucart_ajax_assist.shop_plugin == ‘woocommerce’) {
    `

    But I think it needs to be:
    `
    if (wpmenucart_ajax_assist.shop_plugin == ‘WooCommerce’ || wpmenucart_ajax_assist.shop_plugin == ‘woocommerce’) {
    `

    That way the if statement succeeds correctly if the setting is lower case or uppercase.

    Thank you,

    James

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ewout

    (@pomegranate)

    Hello James,
    Thanks for reporting this. The bug hasn’t surfaced in our own tests with WooCommerce, I’m not sure when/how this would be set to lowercase woocommerce. Testing for both (or using toLowerCase() to normalize) wouldn’t hurth though, so I’ll be sure to add this to the next update release.

    Thanks, I really appreciate your thorough report!
    Ewout

    Plugin Author Ewout

    (@pomegranate)

    Fixed! You can find the github commit here

    This change will be included in the next official release

    Ewout

    Thank you Ewout, much appreciated.

    For us, the dropdown select box on the Plugin’s settings screen used “WooCommerce” instead of “woocommerce”, so every time we saved the plugin settings that if statement would start failing on the frontend.

    The change you’ve implemented should fix the issue going forward so thanks again.

    James

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Bug in wpmenucart-ajax-assist.js’ is closed to new replies.