Error in setting up set up yearly/monthly plans Answered

Post author
Derek Rungsea

Hey all, I’m trying to display the current plan in a pricing table, and in my pricing table webflow page, have set up yearly/monthly plans. In memberstack, I have the 2 prices under one plan. I have successfully gotten the “Current plan” button to show to members according to their plan, but what I’m seeing is that because the annual and monthly prices are both under the same plan, they use the same attribute, and thus, both monthly and yearly plans are showing the same “current plan”

Does anyone know how I can resolve this? Thank you!

Comments

3 comments

  • Comment author
    Marc Hudson

    Interesting! I hadn’t noticed this on my price matrix so I’ll need a fix too. This works for me but will need tweaking slightly to check for status: ACTIVE/TRIALING.

    Just add data-ms-priceid="prc_some-priceid" to a hidden element that you want to display if the user has that priceId in their Member plans data.

    $memberstackDom.getCurrentMember().then(({ data: member }) => {
      console.log(member);// TEMP...
      if (member) {
    		if (!!member.planConnections.length) {
    			$.each(member.planConnections, function(i, plan){
    				if (!!plan.payment) {
    					// is a Paid plan.
    					// Show all elements with attribute: data-ms-priceid="prc_some-id"
    					$(`[data-ms-priceid="${plan.payment.priceId}"]`).show();
    				}
    			})
    		}
      }
    });
    0
  • Comment author
    Derek Rungsea

    Thanks I’ll try it!!

    0
  • Comment author
    Marc Hudson

    You might need to wrap the get Member function in some code that waits for the Member Object to be returned, or you’ll get a console error:
    https://memberstack.slack.com/archives/C033F0SLTLK/p1694103784392219?thread_ts=1693990652.521599&channel=C033F0SLTLK&message_ts=1694103784.392219

    0

Please sign in to leave a comment.