How to get user orderFormId

I’m trying to obtain the user’s orderFormId, but I’m unable to find a way to do so.

I’m currently working on software integrated with VTEX, and I need a method to retrieve the user’s orderFormId. I attempted to use the session manager API, but I couldn’t locate a way to access the vtex_session token from the cookies. Perhaps there is an alternative method, as I’m unable to directly retrieve it from the checkout.vtex.com cookie.

P.S.: Is there a means to obtain session data using the session data id? This value is accessible through the global __RENDER_8_SESSION__ object in the VTEX app, but unfortunately, it lacks the checkout information.

I’ll eagerly await any assistance! Thank you!

2 Likes

Hi Juan!

The orderFormId should be in the checkout.vtex.com cookie itself, as you mentioned. It will specifically be declared as __ofid={{orderFormId}}. You can see as much from a quick test I did on a VTEX store below (cookies visible via the EditThisCookie Extension):

This can also be found in the console via the vtexjs.checkout command:

I will also share here our documentation for vtex.js for Checkout, which you may find helpful.

Eduardo Luciano
Field Software Engineer | VTEX

Hey Eduardo!

The thing is that I need a way to get this information via javascript, and this cookie is http only. Regarding using vtex.js, I also have the constrain that not every client with vtex has vtexjs. I used to do it with vtexjs but some clients stoped using it

Hi Juani and Eduardo!

I’m currently looking for the exact same! If there is any way to achieve it it’ll be awesome. Also, I was trying to solve it using vtexjs but didn’t find a way to run any script inside VTEX html templates, if you have any insight on how you achieve it I would be very grateful.

Regards!

Hi, I’m currently having the same problem.

I’m developing an application external to vtex and I need the orderFormId. I’m not able to get it from the cookies. Did you manage to solve it? @matioportus @Juani