get item id / Requesting a quote based on the dynamic page

Hi Nayeili,

Thank you so much for the response. I am using a dynamic dataset called “lighting”. I saw that you suggested that in one of your comments so I tried this with your code, but isn’t working.

import { session } from 'wix-storage';
import wixLocation from 'wix-location';

$w.onReady(function () {

 $w("#addButton").onClick((event) => {
  $w("#lighting").getCurrentItem();
   .then((results) => {
 let theLighting = results._id; //This line gets the ID of the current product
    session.setItem("results", theLighting); //This line saved the product ID into session storage
   })
   .then(() => {
    wixLocation.to("/selection");  //This line redirects you to the page with the request form
   })
   .catch((error) => {
    console.log(error);
   });
 });

});

Do you know where I have gone wrong? I don’t think I fully understand the concept of getcurrentItem, it also isn’t bringing the data through to the page.