Hello professionals, I have 3 price plans and if the user does not have a price plan, just get a lightbox, what am I doing wrong?
Thank you
import wixData from 'wix-data';
import wixUsers from 'wix-users';
import wixWindow from 'wix-window';
import wixPay from 'wix-pay';
import wixPaidPlans from 'wix-paid-plans';
$w.onReady(function () {
{
wixUsers.currentUser.getPricingPlans() //put offset in parenthesis; to go to 2nd plan, put 1.
.then((pricingPlans) => {
let currentPlan = pricingPlans[pricingPlans.length - 1];
let planName = currentPlan.name;
let qprice = currentPlan.price;
//let benefits = currentPlan.benefits;
let sdate = currentPlan.startDate;
let eDate = currentPlan.expiryDate;
if(planName===""){
wixWindow.openlightbox("Frage_Premium");}
else
$w('#vectorImage10').hide();
$w('#PlanName').text = currentPlan.name;
$w('#ExpirationDate').text = currentPlan.expiryDate.toDateString();
$w('#text185').text = currentPlan.startDate.toDateString();
});
wixPaidPlans.getCurrentMemberOrders()
.then((pricingPlans) => {
let currentPlan = pricingPlans[pricingPlans.length - 1];
$w('#PlanStatus').text = currentPlan.status;
})
}