简体   繁体   中英

How to access property inside of this object?

Trying to access "responseJSON.original_total_price"

This is my code -

  const CartObject = theme.cart.getCart();
  console.log(CartObject.responseJSON.original_total_price)

控制台视图

Making it an async function fixed it.

  const CartObject = await theme.cart.getCart();
  CartObject.total_price

you need to use JSON.parse function on response eg

const responseParsed = JSON.parse(responseJSON.responseText)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM