Dear Wix Team,
I am facing this error when I try calling a currentItem id from the dataset on the dynamic page. Your support is much appreciated. Below is the code used to retrieve data from dataset1 on the dynamic page.
Objective: when customer clicks a button, it should initiate payment taking the custom price, quantity from customer on custom product page and add it into the cart page without altering the original price in the dataset.
import wixData from ‘wix-data’ ; import {createMyPayment} from ‘backend/pay’ ; import wixPay from ‘wix-pay’ ; import wixUsers from ‘wix-users’ ;
export function pay_click_1(event, $w) { let userId = wixUsers.currentUser.id; let productId =$w( " #dataset1 " ).getCurrentItem()._id; let price = String(Number($w( ’ #bookingadvance ’ ).text)) let quantity = String(Number($w( ’ #Quantity ’ ).value)); createMyPayment(event.context.productId,price, quantity) .then( (payment) => { wixPay.startPayment(payment.id); $w( ’ #shoppingCartIcon1 ’ ).addToCart(productId) .then(() => { console.log( “add product ${productId} success” ); }) . catch ((error) => { console.log(error); } ); } ); }
Please Help.