Hi everybody,
I’m looking for a way to get the order id on “thank you” page so that I can update my db records accordingly.
Any suggestions?
Looking forward to hearing back from you
Best,
Emre.
Hi everybody,
I’m looking for a way to get the order id on “thank you” page so that I can update my db records accordingly.
Any suggestions?
Looking forward to hearing back from you
Best,
Emre.
Hi,
Could you elaborate on what you are trying to achieve? what is the use case?
Hi!,
Thank you for your response. I ask my customers to add upload images when they add the product to the basket. After the payment, I need to match the uploaded files with order. Is that possible?
Looking forward to hearing back from you!
Best,
E.T.
I see you never got an answer to this,I too asked a similar question and received nothing in the way of a response let alone help; Wix were just as useless as asking the question was, telling me to ask a question…
anywho the only thing i could think was to get the ID from the data-hook=“order-id-value” element. but this is very hacky and unreliable.
Did you solve this problem?
No I haven’t! That is why I chosen not to use wix anymore.
Hi @jay, Does that actually work with data-hook. Can you share little info on how that is done or link?
Thanks,
Tom
HI Tom,
Unfortunately no, this did not work for a few reasons. The default thank you page element is a closed element and the wix code javascript does not have access to element data attributes like vanilla JavaScript or jQuery would. (I suspect due to wix code resembling angular or such like)
The only way i could solve this was to come out of the default product pages etc from the wix store app and create my own order process using dynamic pages and code from the API. Essentially I pass data from the product page to the thank you page using session storage within the addToCart function similar to the answers here: https://www.wix.com/corvid/forum/main/comment/5abfaf9042d18d00145515ca
and code here: https://www.wix.com/corvid/reference/$w.CartIcon.html#addToCart
Then I had to code through the payment process in order to store the orderId in the session storage too. This does create a lot of work, as a workaround, as you also have to clear any storage when the user abandons the cart etc.
EDIT:
Now i think about it, If it is just the order number you need it could be possible to get it using a get variable from the url?! I haven’t tested any of this atm, but the string at the end of the thank you page url is the order id in the stores/orders “collection” [database]; You can access this using the location API: https://www.wix.com/corvid/reference/wix-location.html
EG:
So after placing an order I get sent to this page url:
https://mywixsite.com/mysite/thank-you-page/7a6fffdd-88cd-473c-924c-0bd3baece411
As you can see the order ID from the database is the last part of the url: 7a6fffdd-88cd-473c-924c-0bd3baece411
Using the wix-location in the code you can parse this out and then do a lookup query in the stores database for this order and return all the details for that row.
Hope this helps
Cheers
Jay
Hi @jay, What about this, you mentioned something about addcart. We can add a product to the cart dynamically from code right? So right now I need a delivery date in the order somehow. So what I have been thinking is that when they pick a delivery date it actually adds a product called “delivery date” to the cart with an option of a date. Would that work you think? Kind of a hack, but do you think would work?
Tom
Would this delivery date be per order or per product?
Yes, well everything on wix code tends to be a bit of a hack in my experience. That may work but it sounds like the addtocart options may be of more use though I’m not sure.
Have a look at the below links whilst I have a think, they may be of some use…
https://www.wix.com/corvid/reference/$w.CartIcon.html#AddToCartOptions
https://support.wix.com/en/article/corvid-adding-a-product-configurator-to-a-wix-stores-site
https://support.wix.com/en/article/adding-a-customer-message-box-to-your-wix-stores-product-page
@jay65866 It would be per order.
@jay65866 Also, I think in the order is different then the url. Thats either a transaction id or some internal id?
@jay65866 , Here is a screen shot of that. The order id is different.
@johnsonsflorists ok per order makes it easier. I would suggest, for a quick easy solution, using the transaction Id in the url as suggested before and add to the thank you page a date selection element below or above the thank you box element to select a date. Then add the code that gets the order ID on load, stores it in a variable and some code to save the date somewhere referencing the order. (I’m unsure if you can add fields to the “stores>>orders” collection but there may be an additional options field) Are you familiar with wix collection queries? [insert, update]
For your second query regarding the url data - the Order No on the page is the order number but is not the order ID. The “Stores>>orders” collection has it’s own ID field for referencing which is hidden. The long string is the actual row ID in the database for that order.
To view this you need to activate wix code mode when editing your site then in the left side panel near the bottom you will see the “Database” section where you should find “>Stores”. click this then “orders”. You should see the orders table. the ID field is hidden so you need to unhide the ID field under “visible fields” [top left of table header].
hope it helps
@jay65866 Thanks for the info! I really appreciate it. Didn’t realize you can show the id. I like this solution, but the only thing is that the notifications have probably already gone out and don’t have a way to control. Unless I can have it not send out automatically and I can manually do this? Is that possible do you know of.
Thanks,
Tom
@johnsonsflorists Unfortunately I don’t, also you would not even be able to include a date in the email without it being a “product” or “customisation” field according to this wix page:
https://support.wix.com/en/article/request-customizing-the-confirmation-email-sent-to-customers-after-purchase
I think the best option then would be to add the delivery date as an additional field / option to the product, similar to what you suggested previously. I believe these would show on the order placed email that is sent out. The only issue is you would have one per product, not order, if a customer adds more than one to the cart;
At least we now know how to get the order id on the thank you page, even if it’s not needed
good luck with your coding, hope you get somewhere