What's wrong with my Shopify checkout additional scripts?

sae
Visitor
2 0 0

I feel like I'm so close on this because if I don't include any of the if statements then I can print the variables on the successful check out screen.  Can you please help me to see what I'm missing here?  Thanks

P.S. yes I have the actual product ID number in there correctly but I added it as 1234567890 for now.  I've also checked that ?ref is set on the permalink url when they click a link on my website.

<script>
Shopify.Checkout.OrderStatus.addContentBox (
  {% for line in checkout.line_items %}
    {% if line_item.product_id == 1234567890 %}
       {% if landing_site_ref %}
       '<h2>Success Message!</h2>', 
       '<p style="color: red; font-weight: bold">Update your account now by  
	   <a href="http://example.com/script.php?email={{ checkout.email }}&ref={{ landing_site_ref }}">clicking here</a></p>'
      )
       {% endif %}
    {% endif %}
  {% endfor %}
</script>

 

Reply 1 (1)

sae
Visitor
2 0 0

I found a bit of mistake in the script with where I showed the order status content box

Still isn't working though

<script>
  {% for line in checkout.line_items %}
    {% if line_item.product_id == 1234567890 %}
       {% unless landing_site_ref == blank %}
Shopify.Checkout.OrderStatus.addContentBox (
       '<h2>Success Message!</h2>', 
       '<p style="color: red; font-weight: bold">Update your account now by  
	   <a href="http://example.com/script.php?email={{ checkout.email }}&ref={{ landing_site_ref }}">clicking here</a></p>'
      )
       {% endunless %}
    {% endif %}
  {% endfor %}
</script>