1080
June 28, 2023, 1:25pm
1
Hi i am tracking the conversions tracking code in checkout script page.
hoverever now i am getting the order number undefined when i am move out the code from the first_time_access it was the working fine.
{% if first_time_accessed %}
(['trackEvent', 'purchase: {
order_id : {{ order.order_number }}
}']);
{% endif %}
Hi @1080
Can you kindly share your store link (with the password, if any) with us? We will check it and suggest you a solution if possible.
1 Like
1080
June 29, 2023, 7:25am
3
@BSS-Commerce
Thanks for the replay
https://sanjay-test-shop.myshopify.com/
store prewview password : stinow
i am to load the gtm script and push the data to gtm
now i want send the data.
but
i was not able to get the all the data like {{order.number}}
i need to get the all the order detail and sent to the GTM.
I hope this information batter to understand my questions.
mthdvd
June 29, 2023, 8:37pm
4
The {{order.order_number}} object will sometimes be null depending on payment provider used. It is not reliable; don’t use it. See the order_number object description: https://shopify.dev/docs/api/liquid/objects/checkout
Instead, you should use “id” if you are just needing a unique number attached to the order.
{% if first_time_accessed %}
(['trackEvent', 'purchase: {
order_id : {{ order.id }}
}']);
{% endif %}
If you actually do need the order number, I’m not aware of any way to get it other than to use a webhook.
Hope that helps!
2 Likes
1080
July 4, 2023, 12:57pm
5
@mthdvd Thanks for the answers Yes it was happen few of the case. I tested with test payment with bogus payment gateway it was work almost some of the case i am getting
{{ order.order_number }}
but this is happens with the production payment gateway.
1080
July 10, 2023, 7:53am
6
@mthdvd as per this Shopify liquid documents.
https://shopify.dev/docs/api/liquid/objects/order#order-order_number
they mention order_number
do you have any idea why some store is not working?
1080
July 10, 2023, 7:54am
7
@BSS-Commerce I shared the Store link please check if you can help.
mthdvd
July 11, 2023, 4:13am
8
@1080 , again – this is the expected behavior as far as I know. It will load some of the time, but not all the time.
1 Like
1080
July 12, 2023, 11:57am
9
@mthdvd can you suggestion working solution if you can., that was really help me.