Dear all,
I am struggling with one as I hope very interesting challenge and I would be extremely thankful to everybody who would try to understand the issue and help me solve it.
Description:
I’ve built a custom members area a customer can access through a payment plan. On the account area are several input fields for the customer to fill in. Most importantly some codes (input fields in a container), if the client buys plan 1, he should be able to enter 1 code. If he buys plan 2 he should see 2 code entry fields and so on up to plan 5 and 5 entry fields.
Challenge:
I have no programming experience and need to find some code that identifies which plan the customer bought and displays the right amount of code containers while the others he has no access to are collapsed and therefore invisible.
General thoughts:
One a payment plan is created it adds a “Plans” dataset with single identifiers, e.g. the slug. My idea was to use this as a trigger to determine which plan was purchased but I cannot program it and I do not know if a connection from the plan dataset and my “Members” is necessary.
The fields that are shown with the codes in the containers should be filled out once the plan is bought and then reappear each time the user logs in to potentially update the data. I managed to program this already and the Members dataset with all required fields exists and is successfully connected to page and input fields.
Is this something somebody can help me with please? I am all done and set, this is the only remaining issue but the absolute key why the website exists in the first place 
Thanks a million in advance,
Patrick
So you have done something like this?
https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area
Then, as the user is logged in, you can get the current users details and check their pricing plan and do something depending on what plan they are on.
https://www.wix.com/corvid/reference/wix-users.html#currentUser
https://www.wix.com/corvid/reference/wix-users.User.html#getPricingPlans
So, you have all the user input elements for the codes for this set to be collapsed on load, if they have pricing plan 1 then you just expand one and the user sees just the one box, if you have pricing plan 2 you expand two boxes and so on.
https://www.wix.com/corvid/reference/$w.CollapsedMixin.html
Hi GOS, thank you very much for your reply and you are absolutely right. The only difference is, I want to collapse only a few fields based on the plan used, the other fields are standard. Do you have any idea how I can code this because the corvid API references are a bit like Chinese to me
Thanks
I wrote the code but I do not get it right, what ever I am trying. Could somebody please have a look?
It does not recognize slug, so it seems the connection to the wix paid plans database seems not to work the way I wrote it.
And I have a second error in the last line, parsing error: unexpected token )
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 purchased
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 {
}
{
});