For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
We have been trying to get the order ID from the thank.you page but it seems that it does not accept the useOrder() API.
We have notice that this is available at the order.status.
Is there a way that we can have the order id?, we need to place a button for the customer to either choose Receipt or Invoice. This button with the order ID is needed because the button will redirect to our platform for connecting with our kind of IRS (Here it is called SII), so the invoice or receipt is legaly valid.
Or at least a button that can route the customer to the status.page, where the order ID is available
Thanks
Hello @fbritop
You can obtain the order ID by using the useApi() hook in the purchase.thank-you.block.render.
const data= useApi();
const orderId=data?.orderConfirmation?.curren?.order?.id
If the solution presented meets your needs and addresses your query effectively, I encourage you to accept it as the chosen answer. This will acknowledge the support you received and aid fellow community members in identifying reliable and effective solutions for their similar concerns.
Thank you.
It may be working for Javascript, but for react, the component is not found, and the selector is invalid, thats what I explain in the first post
Hello @fbritop
You can use optional chaining in js. it's an editor issue.
const orderId=data?.orderConfirmation?.curren?.order?.id
I have rendered this component in the purchase.thank-you.block.render. it's work for me
Thanks, this set me on the right path. There was one thing missing for me to make it work, adding the string argument to the useApi call
const data = useApi("purchase.thank-you.block.render");
const orderId = data?.orderConfirmation?.current?.order?.id
Hi @Huptech-Web ,
Hope you are doing well.
I have started working on making the public app for that I have already created the partners account however I am stuck into getting the Api Scope Access, would you please help me how we can get these and how we have to upload the app on to the shopify store.