Remove old Shopify scripts

Remove old Shopify scripts

  • updated 1 mth ago

We have recently moved to pixel based tracking for our carts and conversions. 
If you have a previous install, you should remove the old parts from your system and then follow the new install guide.


Removing the Hello Retail script:

To begin with, make sure you are logged into the Admin panel of your Shopify webshop. If in doubt, here is the login page: shopify.com/login.

  1. On the dashboard view, navigate to the left-hand side menu.  Click on Online Store.


     
  2. From the drop-down menu, click on Themes.


     
  3. Navigate over to the right-hand side to Debut and click on the drop-down button of Actions.


     
  4. From the drop-down menu, click on Edit code.


     
  5. On the left-hand side, a second menu bar will prompt. In this menu, go down to the folder named Layout and click on the file named theme.liquid. Next, an editor window will appear.


     
  6. Inside the editor window, locate and remove the following piece of code:
    If you cant  fint it, it might be that you have an even older install. in that case, remove anything related to either hello retail,  addwish or awaddgift.
    <script async src="https://helloretailcdn.com/helloretail.js"></script>
    <script>
        window.hrq = window.hrq || [];
        hrq.push(['init', {}]);
        {% assign HelloRetailCartContentsRecreate = '' %}
        {% assign HelloRetailCartProductNumbers = '' %}
        {% for item in cart.items %}
            {% assign HelloRetailCartContentsRecreate = HelloRetailCartContentsRecreate | append: item.variant_id | append:":" | append: item.quantity | append: "," %}
            {% assign HelloRetailCartProductNumbers = HelloRetailCartProductNumbers | append: item.product_id | append: "," %}
        {% endfor %}
        hrq.push(["setCart", {
            total: {{ cart.total_price | divided_by: 100.0 }},
            url: "{{shop.url}}/cart/{{HelloRetailCartContentsRecreate}}",
            productNumbers: [{{HelloRetailCartProductNumbers}}]
        }]);
        [hr_preMoney, hr_postMoney] = "{{ 1 | money_with_currency }}".split(/[0-9,.']+/);
    </script>
  7. Lastly, scroll up and navigate to the top of the screen and click the Save button.

 


Removing the Hello Retail Conversion Script:

  1. When logged in as Admin: Navigate to the left-hand menu and click on Settings at the bottom of the screen - a popup window with settings will appear.
  2. Click on the menu for Checkout.


     
  3. Now scroll down on the checkout page until you find the box Order status page with the input field Additional scripts:


     
  4. Search the Additional scripts input field for the following code snippet and remove it: 
    <script async src="https://helloretailcdn.com/helloretail.js"></script>
    <script type="text/javascript">
        var HelloRetailProductNumbers = [];
        Shopify.checkout.line_items.forEach((item) => HelloRetailProductNumbers.push(item.product_id));
        var HelloRetailPrice = Shopify.checkout.subtotal_price;
        // the if statement below will make sure we always track the order total
        // in the shops base currency.
        // If you have a setup with multiple domains like domain.com/se and domain.com/dk
        // and dont support switching currencies within each of them individually,
        // then you can opt to remove this if statement
        // and have conversions tracked in the shops' presentment currencies.
        if (Shopify.checkout.presentment_currency != Shopify.checkout.currency) {
            var HelloRetailShippingRate = 0;
            if (Shopify.checkout.shipping_rate) {
                HelloRetailShippingRate = Number(Shopify.checkout.shipping_rate.handle.split("-").pop());
            };
            var HelloRetailTotalPrice = Number(Shopify.checkout.total_price_set.shop_money.amount);
            if (HelloRetailShippingRate && HelloRetailTotalPrice) {
                HelloRetailPrice = (HelloRetailTotalPrice - HelloRetailShippingRate).toFixed(2);
            };
        };
        window.hrq = window.hrq || [];
        hrq.push(['init', {}]);
        hrq.push(["trackConversion", {
            total: HelloRetailPrice,
            orderNumber: Shopify.checkout.order_id,
            email: Shopify.checkout.email,
            productNumbers: HelloRetailProductNumbers
        }]);
    </script>
    

    Note: if you cant fint anything it might be because you have an older install.
    Remove anything related to hello retail, addwish or awaddgift.
    Note: if your field is grayed out it's because you have upgraded to shopify's checkout extensibility. In that case you can just leave it like this as the Additional scripts are no longer used.

  5. Navigate to the top of the website and press Save.

Like Follow
  • 2 mths agoLast active
  • 59Views
  • 1 Following