I have a current sessionStorage in place. The .set method is working correctly.
The problem is the key it's not fixed. it's being created with the array of the first product I click.
Like this, I can't have a key value to use the .get method in another page.
This is my JS.
$('.go-to-bag').click(function() {
  var productId = $(this).parent().attr('id');
  var productName = $(this).parent().attr('product-name');
  var productQty = $(this).prev().val();
  var productLWeight = $(this).parent().attr('product-weight');
  var productPesoBruto = $(this).parent().attr('product-pesobruto');
  var productPrice = $(this).parent().attr('product-price');
  var productPricesemiva = $(this).parent().attr('product-pricesemiva');
  var newList = new Object();
  if (sessionStorage.newShoppingList) {
    newShoppingList = JSON.parse(sessionStorage.getItem('newShoppingList'));
  } else {
    newShoppingList = []
  }
  newShoppingList.push({
    productId,
    productName,
    productQty,
    productPrice,
    productPricesemiva,
    productLWeight,
    productPesoBruto
  });
  sessionStorage.setItem('newShoppingList', JSON.stringify(newShoppingList));
  var retrievedObject = sessionStorage.getItem('newShoppingList');
  console.log('retrievedObject: ', JSON.parse(retrievedObject));
});So, I can I get the key so i can use .get method and retrive the value inserted in another page?

 
     
    