Hi all,
I want to give the account owner a certain amount of input fields based on the paid plan he/she purchased.
Plan 1, only one input field (container box); Plan 2 , two input fields and so on.
I am a complete beginner at coding but tried the below, unfortunately it seems that the connection to the Plans database is not working and at the last line I receive an unexpected token error.
Can somebody help me, please?
Thanks so much in advance,
Patrick
import wixUsers from 'wix-users';
import wixData from 'wix-data';
import wixLocation from 'wix-location';
import wixPaidPlans from 'wix-paid-plans';
$w.onReady (function () {
// Call getCurrentMemberOrders() to get the current plan information the logged in user has pruchased
wixPaidPlans.getCurrentMemberOrders()
wixUsers.currentUser.getWixPaidPlans()
.then( (WixPaidPlans) => {
let slug = slug; // "1-plan"
// Based on the "slug" of the paid plan purchased, I want to show/hide container boxes. If the account owner purchased "Plan1" (Slug is "1-plan"), all container boxes (2-5) should be hidden, if "Plan2 " as purchased, container box 2 should be available but 3-5 hidden and so on.
let value = $w("#slug");
if (value === "1-plan") {
$w("#box2").collapse();
$w("#box3").collapse();
$w("#box4").collapse();
$w("#box5").collapse();
} else if (value === "2-plan") {
$w("#box3").collapse();
$w("#box4").collapse();
$w("#box5").collapse();
} else if (value === "3-plan") {
$w("#box4").collapse();
$w("#box5").collapse();
} else if (value === "4-plan") {
$w("#box5").collapse();
//If "Plan5" was purchased, all container boxes should show.
} else {
}
{
});