#Jgreensmith12

1 messages · Page 1 of 1 (latest)

blazing crescentBOT
tired topaz
#

Hi,
Yes you can't expand attributes from Webhook events.
You need to make an extra call and get the priceId

main vapor
#

ok, thankyou i'll give that a try

main vapor
#

Hi, sorry i'm not sure what call to make to access the priceId using the event data

#

and the listLineItems doesn't return a productid!

cedar minnow
#

Hey, can you share the JSON response from the API request in the screenshot? I think that should work

#

Also, what it is exactly you want. You mentioned both a price and product ID (both should be there)

main vapor
cedar minnow
#

Is that from a console.log?

main vapor
#

i need to access price.product because there's extra infomation

#

yes thats the console.log items

cedar minnow
#

Yeah the issue is console.log only prints top level JSON, it doesn't also print any deeply nested hashes

#

(you can tell by the price: [Object] notation)

#

Try console.dir() instead

#

I suspect the data you want is there, you just can't see it because of console.log limitations

main vapor
#

ok, i'll give it a go thanks

#

sorry, that did the same thing

cedar minnow
#

If you log the actual field as opposed to the full payload, do you get the value you expect? i.e. items.data[0].price.id

#

In other words, console.dir() is the way to see all the properties of a specified JavaScript object in console by which the developer can easily get the properties of the object.
https://developer.mozilla.org/en-US/docs/Web/API/console/dir

The method console.dir() displays an interactive list of the properties of
the specified JavaScript object. The output is presented as a hierarchical
listing with disclosure triangles that let you see the contents of child objects.

main vapor
#

i'll give it a go thanks

#

that worked!! thankyou very much, really appreciate your help 😁