Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Why isn't my menu button functioning correctly?

Why isn't my menu button functioning correctly?

Felix_o
Shopify Partner
21 0 5

Skärmbild (101).png

This menu button is not working, can someone help me? Here is my shopify URL https://58ad76-2.myshopify.com/

Replies 4 (4)

DigiDecoded
Shopify Partner
162 19 18

what recently happened to your store>?

Danish | Full Stack Developer @ Esire.Inc
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- Hire me for your next task! | Email | WhatsApp | Website

Laza_Binaery
Shopify Partner
191 42 62

Hi @Felix_o 

 

Think you have added some JavaScript code, probably in theme.liquid but you did not copy all the code. Try to find

 

      window.routes = {
        root_url: `/`,
        cart_add_url: `/cart/add`,
        cart_change_url: `/cart/change`,
        cart_update_url: `/cart/update`,
        predictive_search_url: `/search/suggest`,
        cart_url: `/cart`
      };
      
      window.theme_variables = {
        settings: {
          money_format: "{{amount_no_decimals}} kr",
          money_with_currency_format: "{{amount_no_decimals}} SEK",

        }
      }
      var SHTHelper = window.SHTHelper || {};
      SHTHelper.qs = document.querySelector.bind(document);
      SHTHelper.qsa = document.querySelectorAll.bind(document);
      SHTHelper.qid = document.getElementById.bind(document);
      SHTHelper.qde = document.documentElement;

      var SHTLanguage = window.SHTLanguage || {};
      SHTLanguage.cart = {
        ERROR: `There was an error while updating your cart. Please try again.`,
        QUANTITY_ERROR: `You can only add [quantity] of this item to your cart.`,
      };

      SHTLanguage.free_shipping_bar = {
        UNFULFILLED: `You're <b>[remaining_amount]</b> away from free shipping`,
        FULFILLED: `Your order qualifies for free shipping`,
      };

      SHTLanguage.product = {
        PRODUCT_ADD_TO_CART: `Add to cart`,
        PRODUCT_SOLD_OUT: `Slutsåld`,
        PRODUCT_UNAVAILABLE: `Otillgänglig`,
        PRODUCT_UNAVAILABLE_WITH_OPTION: `[value] - Unavailable`,
      };
     
    });
  };

  vismaAutoivoice.calculator();
});

 

There are few closed brackets that are never opened so you get a JS error in the console 

Uncaught SyntaxError: Unexpected token '}'     58ad76-2.myshopify.com/:470 
Kind regards
Laza
www.binaery.com
Felix_o
Shopify Partner
21 0 5

Ok thanks, How do I fix it?

 

Laza_Binaery
Shopify Partner
191 42 62

@Felix_o 

 

You have to help me out a bit. But the first step to fix the error is changing the following code 

<script>
      window.routes = {
        root_url: `/`,
        cart_add_url: `/cart/add`,
        cart_change_url: `/cart/change`,
        cart_update_url: `/cart/update`,
        predictive_search_url: `/search/suggest`,
        cart_url: `/cart`
      };
      
      window.theme_variables = {
        settings: {
          money_format: "{{amount_no_decimals}} kr",
          money_with_currency_format: "{{amount_no_decimals}} SEK",

        }
      }
      var SHTHelper = window.SHTHelper || {};
      SHTHelper.qs = document.querySelector.bind(document);
      SHTHelper.qsa = document.querySelectorAll.bind(document);
      SHTHelper.qid = document.getElementById.bind(document);
      SHTHelper.qde = document.documentElement;

      var SHTLanguage = window.SHTLanguage || {};
      SHTLanguage.cart = {
        ERROR: `There was an error while updating your cart. Please try again.`,
        QUANTITY_ERROR: `You can only add [quantity] of this item to your cart.`,
      };

      SHTLanguage.free_shipping_bar = {
        UNFULFILLED: `You're <b>[remaining_amount]</b> away from free shipping`,
        FULFILLED: `Your order qualifies for free shipping`,
      };

      SHTLanguage.product = {
        PRODUCT_ADD_TO_CART: `Add to cart`,
        PRODUCT_SOLD_OUT: `Slutsåld`,
        PRODUCT_UNAVAILABLE: `Otillgänglig`,
        PRODUCT_UNAVAILABLE_WITH_OPTION: `[value] - Unavailable`,
      };
     
    });
  };

  vismaAutoivoice.calculator();
});

to

 

<script>
      window.routes = {
        root_url: `/`,
        cart_add_url: `/cart/add`,
        cart_change_url: `/cart/change`,
        cart_update_url: `/cart/update`,
        predictive_search_url: `/search/suggest`,
        cart_url: `/cart`
      };
      
      window.theme_variables = {
        settings: {
          money_format: "{{amount_no_decimals}} kr",
          money_with_currency_format: "{{amount_no_decimals}} SEK",

        }
      }
      var SHTHelper = window.SHTHelper || {};
      SHTHelper.qs = document.querySelector.bind(document);
      SHTHelper.qsa = document.querySelectorAll.bind(document);
      SHTHelper.qid = document.getElementById.bind(document);
      SHTHelper.qde = document.documentElement;

      var SHTLanguage = window.SHTLanguage || {};
      SHTLanguage.cart = {
        ERROR: `There was an error while updating your cart. Please try again.`,
        QUANTITY_ERROR: `You can only add [quantity] of this item to your cart.`,
      };

      SHTLanguage.free_shipping_bar = {
        UNFULFILLED: `You're <b>[remaining_amount]</b> away from free shipping`,
        FULFILLED: `Your order qualifies for free shipping`,
      };

      SHTLanguage.product = {
        PRODUCT_ADD_TO_CART: `Add to cart`,
        PRODUCT_SOLD_OUT: `Slutsåld`,
        PRODUCT_UNAVAILABLE: `Otillgänglig`,
        PRODUCT_UNAVAILABLE_WITH_OPTION: `[value] - Unavailable`,
      };

      SHTHelper.qde.className = SHTHelper.qde.className.replace('no-js', 'js');
      Shopify.designMode && SHTHelper.qde.classList.add('shopify-design-mode');
      var SHTDefer = [];

      document.addEventListener('DOMContentLoaded', function () {
        while (SHTDefer.length) SHTDefer.shift().call();
      });      
    </script>

 

But please note, do not copy the complete code. You probably have this in theme.liquid file but there are some liquid variables so just delete

    });
  };

  vismaAutoivoice.calculator();
});

and add

      SHTHelper.qde.className = SHTHelper.qde.className.replace('no-js', 'js');
      Shopify.designMode && SHTHelper.qde.classList.add('shopify-design-mode');
      var SHTDefer = [];

      document.addEventListener('DOMContentLoaded', function () {
        while (SHTDefer.length) SHTDefer.shift().call();
      });  

 

I did find code in the Blum theme demo, as I am guessing that is your theme. With this JAvaScript error should be fixed and menu and probably some other things should work. 

 

Now about "vismaAutoivoice.calculator();" I really could not find much . JIt might be connected to this app

https://apps.shopify.com/visma-e-conomic-sync

 

but you should be able to confirm that or maybe you added some custom code manually. I am not sure.

Kind regards
Laza
www.binaery.com