I made a form that submits orders and want it to be able to fill automatically product related questions when someone accesses it, however i lack the knowledge to do so. I would appreciate it if anyone helped me do it. Form is on a different page and i need a way to get product details to be transferred to form fields so that users don’t have to manually enter them.
I found a solution, here it is if anyone needs it.
product page:
import wixData from 'wix-data';
import {session} from 'wix-storage';
$w.onReady(function ()
{
$w.onReady(function () {
$w('#MyproductPage').getProduct()
.then( (product) => {
let productName = product.name;
$w('#convProduct').value = productName;
session.setItem('conv', $w("#convProduct").value);
} )
.catch( (error) => {
console.log(error);
} );
} );
});
form page:
import {session} from 'wix-storage';
$w.onReady(function () {.
let name = session.getItem('conv');
$w("#inputProduct").value = name;
});