render snippet not working in checkout.liquid

Solved

render snippet not working in checkout.liquid

GloriaL
Visitor
3 0 0

Hi all,

 

We have 2 site using the simple GTM snippet, but one site renders normally the other site shows nothing for the snippet at all.

- site with render snippet

Screen Shot 2022-08-31 at 15.27.09.png

- site with no render snippet

Screen Shot 2022-08-31 at 15.30.44.png

We'd love to know the following:

1. How we can debug for render?

2. What would be the possible reason that might doesn't work?

3. We have multiple render snippet in checkout.liquid, if one of the snippet has error, would it affect other snippet to render?

 

We are new to Shopify and this community, please let me know if lack any information, and much appreciated for any help.🙂

 

Layout/checkout.liquid

<!DOCTYPE html>
<html lang="{{ locale }}" dir="{{ direction }}" class="{{ checkout_html_classes }}">
  <head>
  {% render 'elevar-head' %}
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
...
  {% render 'other-part' %}
...

 Snippets/elevar-head.liquid

<!--
...some comment here
-->
<!-- Google Tag Manager -->
<script>
  window.dataLayer = window.dataLayer || [];
</script>
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({"gtm.start":
  new Date().getTime(),event:"gtm.js"});var f=d.getElementsByTagName(s)[0],
  j=d.createElement(s),dl=l!="dataLayer"?"&l="+l:"";j.async=true;j.src="https://www.googletagmanager.com/gtm.js?id="+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,"script","dataLayer","GTM-xxxxxx");
</script>
<!-- End Google Tag Manager -->
<script id="elevar-gtm-suite-config" type="application/json">{"gtm_id": "GTM-xxxxxx", "event_config": {"cart_reconcile": true, "cart_view": true, "checkout_complete": true, "checkout_step": true, "collection_view": true, "product_add_to_cart": true, "product_add_to_cart_ajax": true, "product_remove_from_cart": true, "product_select": true, "product_view": true, "search_results_view": true, "user": true, "save_order_notes": true}, "gtm_suite_script": "https://shopify-gtm-suite.getelevar.com/shops/xxxxxxxxxxxxxxxxxxxxxxxxxx/2.38.0/gtm-suite.js", "consent_enabled": false}</script>

 

Accepted Solution (1)
ALLU
Shopify Partner
1 1 0

This is an accepted solution.

Please make sure that you have your checkout.liquid file enabled by the Shopify. Occasionally during theme copy the file might show up in your library, but it does not allow actually render anything if not being enabled.  

View solution in original post

Replies 4 (4)

MarinaPetrovic
Shopify Partner
559 124 193

Hi @GloriaL , if you are not on Shopify Plus, you don't have a direct access to checkout.liquid. 
Go to settings > checkout and look for additional scripts, this is the place where you should add piece of code. 🙂

M.Petrovic | Shopify Developer
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
GloriaL
Visitor
3 0 0

Hi @MarinaPetrovic ,

Thank you for the fast response.😊

Yes, we are using the Shopify Plus, the checkout.liquid works properly only except the extra render snippet we added in the header.

Do you have any information regarding that?

ALLU
Shopify Partner
1 1 0

This is an accepted solution.

Please make sure that you have your checkout.liquid file enabled by the Shopify. Occasionally during theme copy the file might show up in your library, but it does not allow actually render anything if not being enabled.  

GloriaL
Visitor
3 0 0

Hi ALLU,

Thank you so much for the answer. Yes, that’s exactly what happens.

 

We have reached out to the Elevar support, with their help to check, it turns out that our client copied the theme from the other site, so we did see a checkout.liquid but the functionality was not enabled. 

After helping our client to enable the checkout functionality, everything works fine.🙂