replace "order.{anything}" for "checkout.order_id"

replace "order.{anything}" for "checkout.order_id"

jorgeplantz
Visitor
2 0 1

We received today an email asking us to replace "order.{anything}" for "checkout.order_id" but I cant find this [Additional Scrips] to update this. 

 

Then when I enter the settings > checkout I see in the first section of the page "Settings (New)" saying "Your Thank You and Order Status page have to be replaced"

 

Can someone pls help me?

 

Thanks a lot in advance!

 

Screenshot 2024-06-12 221247.png

Replies 12 (12)

ImTired
Tourist
6 0 0

I received the same email. I am using metafields to show a custom order status update and when I made the change, that no longer worked. I ended up just changing it back because I like being able to update customers through their order status page, without needing to purchase anything additional. I'm getting so frustrated with this system that they keep changing on us.

SoapAndTheSea
Visitor
1 0 0

pault70
Tourist
9 0 6

I couldn't find it either. Also "anything" is a really stupid parameter name to send out to non-technical customers. Is the parameter actually called "anything" or does it mean that anything can be between the quotes like "ABC", "asdf", "1337" etc??

osamafarooqi71
Shopify Partner
254 21 44

Hello @jorgeplantz , 

Shopify is evolving and introducing a new set of APIs to improve and scale the platform. In order to resolve this you need to follow the few steps below and you;ll be able to fix it.

 

  1.  Login into your Shopify Admin dashboard.
  2. Go to settings (from the bottom left side of the screen)
  3. Then go to Checkout using the sidebar and scroll down. There you'll find the "Additional scripts".
  4. In the text box, you just need to find "{{ order.order_number }}" or any text next to "order.xxxx". This order is an object and the order_number is it's property. So, we need to replace order object with checkout object, in this case, "checkout.order_id".

 

Path=> Shopify Dashboard > Settings > Checkout > Additional scripts

Before

 

<!-- Purchase Conversion Event Start -->
<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({ ecommerce: null });
{% if first_time_accessed %}
dataLayer.push({
  event: "purchase_complete",
  ecommerce: {
      transaction_id: "{{ order.order_number }}",
      value: {{ total_price | times: 0.01 }},
      tax: {{ tax_price | times: 0.01 }},
      shipping: {{ shipping_price | times: 0.01 }},
      currency: "{{ order.currency }}",
        }
});
{% endif %}
</script>
<!-- Purchase Conversion Event End -->

 

After

<!-- Purchase Conversion Event Start -->

<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({ ecommerce: null });
{% if first_time_accessed %}
dataLayer.push({
  event: "purchase_complete",
  ecommerce: {
      transaction_id: "{{ checkout.order_id }}",
      value: {{ total_price | times: 0.01 }},
      tax: {{ tax_price | times: 0.01 }},
      shipping: {{ shipping_price | times: 0.01 }},
      currency: "{{ checkout.currency }}",
        }
});
{% endif %}
</script>

<!-- Purchase Conversion Event End -->

 

 

If you're not familiar with this, please consider contacting a technical person or hire a developer. Any minor mistake can impact analytics and lower conversion results tracking. 

 

Feel free to reach out the me if you still need any help.

 

Regards,

Osama Farooqi

Shopify Theme Developer | Contact me | Hire expert
- Was my reply helpful? Click Like 🙂 to let me know | Buy Me Coffee
- Was your question answered? Mark this as Accepted Solution
Shaymaa
Visitor
1 0 0

Hi Osama,

 

Many thanks. I received that email, too. I followed the steps you mentioned, but I still see the attached error message. The mentioned incompatible apps that I have are Google Analytics and Microsoft Clarity. I made the changes to the following additional script which is at the setting- checkout—the additional script has the code for Google Analytics and Microsoft Clarity. Please let me know how I can solve it. Thanks.

 

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-VKB2PDJ7Y4"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-VKB2PDJ7Y4');
{% if first_time_accessed %}
gtag("event", "purchase", {
transaction_id: "{{ checkout.order_id }}",
value: {{ total_price | times: 0.01 }},
tax: {{ tax_price | times: 0.01 }},
shipping: {{ shipping_price | times: 0.01 }},
currency: "{{ checkout.currency }}",
items: [
{% for line_item in line_items %}
{
item_id: "{{ line_item.product_id }}",
item_name: "{{ line_item.title | remove: "'" | remove: '"' }}",
currency: "{{ checkout.currency }}",
price: {{ line_item.original_price | times: 0.01 }},
quantity: {{ line_item.quantity }}
},
{% endfor %}
]
});
{% endif %}
</script>

<script type="text/javascript">
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "lmp0ktcva5");
</script>

 

 

Screenshot 2024-06-14 at 11.01.19 PM.png

mrycko
Shopify Partner
5 0 0

My client also received such an email.
In additional scripts, I have this line in the analytics script.

'transaction_id': '{{ order.order_number }}',


Will changing order.order_number to checkout.order_number or checkout.order_id (as it was in the email) solve the problem and not kill the analytics?
Which version is correct checkout.order_number or checkout.order_id?

osamafarooqi71
Shopify Partner
254 21 44

Hello @mrycko ,

"checkout.order_id"  is the correct one. You also need to update the currency as well.

 

Before:

currency: "{{ order.currency }}",

 

After:

currency: "{{ checkout.currency }}",

 

Feel free to reach out the me if you still need any help.

 

Regards,

Osama Farooqi

Shopify Theme Developer | Contact me | Hire expert
- Was my reply helpful? Click Like 🙂 to let me know | Buy Me Coffee
- Was your question answered? Mark this as Accepted Solution
razariusu
Shopify Partner
1 0 0

Have you verified that "order.order_number" has to be replaced with "checkout.order_id"? It doesn't make sense as the returned value would be different.

I'd say the whole point is referencing the checkout object instead of order.

osamafarooqi71
Shopify Partner
254 21 44

Hi @razariusu , if you read the official email, you'll notice this that they mentioned to replace the  "order.order_number" with "checkout.order_id". The reason behind this is 'The field(s) "order.(anything)" are populated during order creation. With Checkout Extensibility, this happens independently of the Thank You page loading to improve scale and performance.

 

However, "checkout.order_id", on the other hand, is a common and unique identifier across checkout and order creation. It is available as soon as checkout is completed and can reliably be used to tie together analytics, downstream systems, and the buyer experience.

 

 Moreover, it'll be sunset soon. So, batter to migrate it to Custom Pixels in Shopify.

 

Feel free to reach out the me if you still need any help.

 

Regards,

Osama Farooqi

Shopify Theme Developer | Contact me | Hire expert
- Was my reply helpful? Click Like 🙂 to let me know | Buy Me Coffee
- Was your question answered? Mark this as Accepted Solution
lynth
Shopify Partner
80 3 6

You have to modify it from the Liquid order object to the Liquid checkout object. That's all. Read the documentation and replace it. 

If my tips are useful, just mark it as the solution. Cheers!
Feeling grateful? Buy me a coffee!

osamafarooqi71
Shopify Partner
254 21 44

 

Hello everyone,

In addition to my previous reply, I recommend upgrading Additional Scripts to Checkout Extensibility. Shopify has set a deadline of August 28, 2025, for this transition.

replace order.anything for checkout.order_id upgrade to checkout extensibility in shopify.png

 

Therefore, please upgrade your scripts to Shopify Checkout Extensibility before this date. If you are not a developer, it is advisable to hire a developer to handle the upgrade for you.

 

Reference: https://help.shopify.com/en/manual/checkout-settings/customize-checkout-configurations/checkout-exte...

 

Feel free to reach out the me if you still need any help.

 

Regards,

Osama Farooqi

Shopify Theme Developer | Contact me | Hire expert
- Was my reply helpful? Click Like 🙂 to let me know | Buy Me Coffee
- Was your question answered? Mark this as Accepted Solution
lynth
Shopify Partner
80 3 6

Did you try to implement the Custom Pixels instead of the Additional Scripts? Does it work? I heard there is a problem with sending data to the GTM. Please tell me more about it. You can use the Customer events but it's run in the sandbox environment and you can't grab everything. Alternatively, you can create your own app, but I heard there is no possibility to push data directly to the GTM. Please correct me if I'm wrong.

https://shopify.dev/docs/api/web-pixels-api#app-web-pixels

If my tips are useful, just mark it as the solution. Cheers!
Feeling grateful? Buy me a coffee!