js web storage newbie here.
I'm working on a billing page for a Wordpress site.
This page needs to show the items that a user has added to the cart on the previous (checkout page).
I have saved a new entry in the session storage database to show items in a user's cart like so :
setStorage_(data) {
window.sessionStorage.setItem('tbhCart', JSON.stringify(data));
}
How can I retrieve this data & display it on the next page (billing page)?
Use getItem()
on sessionStorage
.
var tbhCart = sessionStorage.getItem("tbhCart");