How to show/hide Webflow elements based on plan-id and add multiple content-ids for gated content? Answered

Is it possible to show/hide elements in webflow based on plan-id rather than on content-id?

I see you can do free/paid visibility, but i'm wondering if you can do it based on the specific plan-id

Comments

6 comments

  • Comment author
    Memberstack Team
    • Official comment

    The script #188 is exactly what you’re looking for. By default, Memberstack’s data-ms-content attributes only let you toggle visibility based on general states like free vs. paid, but they don’t give you control at the individual plan level.

    This script solves that gap by letting you show or hide elements dynamically based on the specific plan‑ID a member is subscribed to. That means you can tailor visibility for each plan tier directly in Webflow, without having to rely on broad content‑id logic. It’s a more relevant solution because it gives you precise control over what each plan sees, making your pricing tables and gated content much more flexible and user‑friendly.

  • Comment author
    Julian Galluzzo

    unfortunately i dont think so but if yourse you can just make a gated content group for that plan

    0
  • Comment author
    Chukwudi

    Jonathan Gallegos While we do not have an out-of-the-box feature to implement this, you can do it with Javascript.

    Here's a code snippet to achieve that- you would have to modify it to suit your needs:

    <script>
    window.$memberstackDom.getCurrentMember().then((member) => {
    if (member.data) {
    const divA = document.querySelector('#divA');
    const divB = document.querySelector('#divB');// Hide buttons initially
    divA.style.display = 'none';
    divB.style.display = 'none';const planConnections = member.data["planConnections"];
    if (planConnections && planConnections.length > 0) {
    const planA = "pln_IDForPlanA"; // Replace with the Plan ID of Plan A
    const planB = "pln_IDForPlanB"; // Replace with the Plan ID of Plan B
    const planIds = planConnections.map(connection => connection.planId);if (planIds.includes(planA) || planIds.includes(planB)) {
    if (planIds.includes(planA)) {
    divA.style.display = 'block';
    }
    if (planIds.includes(planB)) {
    divB.style.display = 'block';
    }
    } else {
    console.log('no active plan');
    }
    }
    })
    </script>
    0
  • Comment author
    Jonathan Gallegos

    Thanks! This is helpful

    Going to play around with it

    0
  • Comment author
    Fausto Di Marco

    Hello guys, Does someone know if can I add more than one content id in the gated content: for example data-ms-content= verified-member-ot !pending-verification?

    0
  • Comment author
    Raquel Lopez

    You can add only gated content id per element. If you need to add more, you can create a parent div and add another. So you have parent div with one gated content id and child div with another gated content id

    0

Please sign in to leave a comment.