Limit Shared Subscriptions based on user choice

2 months 3 weeks ago - 2 months 3 weeks ago #329934 by galanopd
I have created a subscription plan with shared subscriptions limit set to e.g. 20
I have also created an int userfield for the user to choose how many licenses to buy and this field increases the price of the plan per license.
I can’t figure out how to allow as many shared subscriptions as the user chooses in the int userfield. For instance, the user might choose 3 licenses but he will still have 20 available shared subscriptions. How can I limit this? Connecting the Family plan Limit to the int field will give 20 rather than 3 which is the result that I need. Maybe an AutoAction or another way?

EDIT: Use example to this would be for instance when a company buys a plan with 23 shared subscriptions for its employees but the plan has limit 30. So the remaining 7 should not be available to the company.

Please Log in to join the conversation.

2 months 3 weeks ago #329939 by krileon
I don't understand why you're trying to do it this way? The share limit parameter should be set to pull its limit from your license integer field. So if they buy 3 they can share it 3 times. Within your plan under Integrations > Family Plans set "Limit" to your license field and it will be based entirely off the value of that field.

There is no way to let them buy 20 but only use 3 and that doesn't really make any sense to me.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

2 months 3 weeks ago - 2 months 3 weeks ago #329943 by galanopd
Ok, I will explain better

I have a plan for professionals (PLAN-PRO) at 100 USD. This plan has shared subscriptions that I want to limit to 3.
Now let's suppose a professional buys this plan subscription and he only needs to buy 2 "licenses". So he sets the int userfield named "Number of licenses" to 2 but this field has a max limit of 3 . Then the price of the plan is calculated by this userfiled and it adds another 100 USD (original price of plan + 1 more license). So he pays 200 USD for the 2 licences.

Now when he goes to share subscriptions and he can share 2 more subscriptions rather than just 1 because the Shared subscription limit reads the int userfield max limit (3) and not what the user has chosen (2) and actually paid for.

I need to have max 3 because another user might buy 3 licenses.
The same applies to other plans with a higher limit. In other words I don't want to allow the user to have more "licenses" (shared subscriptions) that what he has paid for.

It will be a nightmare to create the same plan as many times as the max level of shared subscriptions... Imagine that I have a plan for large companies with 100 licenses. I would need to create 100 plans, each for every added user :lol:

Please Log in to join the conversation.

2 months 3 weeks ago - 2 months 3 weeks ago #329947 by krileon
You need to adjust your max limit field based off the number of licenses they selected. You should be able to do this using the CBSubs Fields integration.

I assume you're using CBSubs Options to select the number of licenses. In which case you can use the substitutions it provides to get the amount they selected. You can find the substitution structure in Integrations > Options > Display at the bottom.

So for example [PLAN_OPTS_PRICE] will return the name of the price/duration they selected when using Prices feature. Example as follows.

Integrations > Options > Prices
Name: 1-yr
Regular Price of plan: 50
Regular Validity duration: 1 year

With the above [PLAN_OPTS_PRICE] would return "1-yr". Plan Options have a substitution per-option. Example as follows.

Integrations > Options > Options
Title: Licenses
Name: licenses
Values
1: Value = 1, Label = 1 License, Price: 50
2: Value = 2, Label = 3 License, Price: 100
3: Value = 3, Label = 3 License, Price: 150

With the above [PLAN_OPTS_OPTION_{OPTION_NAME}] would become [PLAN_OPTS_OPTION_LICENSES] since {OPTION_NAME} is replaced by the options name which in this example is "licenses". [PLAN_OPTS_OPTION_LICENSES] would result in returning "1" for example if 1 License was selected.

Now these can all be used in IF substitutions as well. So for example lets set an integer field based off the price being selected in the below example.

Integrations > Options > Prices
Name: 1-license
Regular Price of plan: 50
Regular Validity duration: 1 year
Name: 2-license
Regular Price of plan: 100
Regular Validity duration: 1 year
Name: 3-license
Regular Price of plan: 150
Regular Validity duration: 1 year

[cb:if PLAN_OPTS_PRICE="1-license"]1[cb:elseif PLAN_OPTS_PRICE="2-license"]2[/cb:elseif][cb:elseif PLAN_OPTS_PRICE="3-license"]3[/cb:elseif][cb:else]0[/cb:else][/cb:if]

This should set the integer field in CBSubs Fields integration usage to 0, 1, 2, or 3 based off the pricing option selected.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: galanopd

Please Log in to join the conversation.

2 months 3 weeks ago - 2 months 3 weeks ago #329950 by galanopd
Please disregard everything above! It works fine using the int userfield only. For some weird reason, when in Family Plans->Limit I was using the int userfield it was ALWAYS returning the max value of the field. Now I tried again and it works fine!

Please Log in to join the conversation.

2 months 3 weeks ago - 2 months 3 weeks ago #329956 by galanopd
Thank you for the above suggestion, it is very helpful in many cases, I will use it. I have the following questions though
  1. When it comes to 100 licences, I will have to create 100 options (not very convenient)?

  2. How will I calculate a discount based on the number of licenses? Promotions have "CB Field containing percentage", so where can I set [PLAN_OPTS_OPTION_LICENSES] to relate the promotion (discount) with the number of users?
    Tried something like the below using a code field but I suppose I do something wrong
    $licenses_p = '[PLAN_OPTS_OPTION_userlicenses_p]';
    if ( $licenses_p === 1 ) {
     return 'no discount';
    }
    if ( $licenses_p === 2 ) {
     return 3;
    }
    if ( $licenses_p === 3 ) {
     return 6;
    }
    return 0;

  3. How will I relate the limit of Shared subscriptions to [PLAN_OPTS_OPTION_LICENSES] so it allows only as many subscriptions as licences paid ?
    Maybe a code field for the limit using with the same logic as the previous one could make it work?
    $licenses_p = '[PLAN_OPTS_OPTION_userlicenses_p]';
    if ( $licenses_p === 1 ) {
     return 1;
    }
    if ( $licenses_p === 2 ) {
     return 2;
    }
    if ( $licenses_p === 3 ) {
     return 3;
    }
    return 0;

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.228 seconds

Facebook Twitter LinkedIn