Okay
  Public Ticket #4509415
Sub Account Restrictions
Open

Comments

  •  1
    Michael started the conversation

    Hello,

    Right now I have created a customer named Qloudly. This customer has access to create sub-accounts (accounts of Qloudly). 

    I wish to set a Maximum Order rule type for all sub-accounts of a given customer (in this case Qloudly). It is in the field "For who:" that I am falling short, how do I choose "For all sub accounts of this account, but not the main account"?


    Thanks in advance :) 

  •  2,565
    WebWizards replied

    Hi Michael,

    Thanks for reaching out about this. Unfortunately that's not possible with the current way subaccounts work in B2BKing.

    Subaccounts inherit the properties and rules from their parent account, so any rule you set would apply to both the parent (Qloudly) and all its subaccounts together. There's no built-in way to treat the parent account and subaccounts differently when it comes to rules.

    One alternative you might consider is using the order approval feature. This would allow the parent account to review and approve orders from subaccounts before they go through, which could give them some control over subaccount purchases.

    Beyond that, you'd need a custom solution / code snippet specifically for those subaccounts users.

    If it helps, I can try to provide you with a basic code snippet solution to set a max order for specific users (you would need to specify the subaccount user IDs, and the max limit in the code)

    Let me know if I can help,

    Kind regards,
    Stefan

  •  1
    Michael replied

    Hi Stefan,

    Thank you for your reply, that’s unfortunate news. I imagine I’m not the only one with customers where the main account wants to define rules and limits for its subaccounts, while being exempt from those same restrictions itself.

    That thought gave me an idea for a simpler approach to the custom solution you mentioned:

    Instead of writing code to detect and apply limits to every subaccount of a parent, perhaps it’s cleaner to exclude the main account from the existing spending limit rule. In other words, the Dynamic Rule would still apply normally to all subaccounts, but if the system detects the main account itself, it simply overrides the rule and sets the limit to 0 (infinite).

    Would that approach be possible to implement?

  •  1
    Michael replied

    Hello again,

    I’m following up regarding the Maximum Order Value feature.

    Is it possible to implement this on a time-based basis rather than per checkout?

    My customers would like the main account to have an overview of each subaccount’s spending within a given time period, regulated by the MOV, so they can easily monitor financial activity. The goal is for each subaccount to have a defined spending allowance (e.g., XXXX amount over YYYY time). Once that period ends, any remaining allowance would roll over into the next cycle.

    To clarify the structure:

    • Main Account: The company’s central account — responsible for setting rules, approving orders, and managing limits.

    • Sub Account: Each employee account operating under the main account’s rules and spending limits.

    Would such a time-based MOV system be possible, or could it be achieved through customization?

  •  1
    Michael replied

    Before this gets too heavy on my replies, let me just summarize what my request is about so you don't try to find heads and tails in 3 replies from me:

    I’d like to introduce a time-based Maximum Order Value (MOV) system (which in essence iss Maximum Spending Value), rather than one that resets on each checkout. The idea is that each subaccount has a spending allowance (e.g., XXXX amount per YYYY time period), and when that period ends, any remaining balance rolls over into the next cycle. The main account should be able to view and manage these limits for its subaccounts.

    Since that’s not currently possible natively, I’m wondering if it could be approximated through customization — for example, by simply excluding the main account from the existing MOV rule.
    That way, the Dynamic Rule would still apply to all subaccounts, but if the system detects the main account, it would override the restriction (effectively setting the limit to infinite).

  •  2,565
    WebWizards replied

    Hi Michael,

    Thanks for clarifying. This kind of time-based spending limit system with rollover functionality isn't something B2BKing handles natively - it would involve quite a few complex changes including parent account control of limits, time tracking, rollover calculations, etc.

    While this is not something we can fully provide as part of support, I wanted to try and help point you in the right direction. I've put together a basic code snippet that gets you partway there: https://pastecode.io/s/9gs3ick4

    This code does quite a bit already - it shows the spending limit on the subaccount page, in the subaccounts list, and at cart/checkout. You can see it in action here: https://www.loom.com/share/901cdb5ed2f447aca8ddf7f583bd0394

     

    However, I need to be clear that this is incomplete and would need significant additional work, testing, and refinement on your end. We're limited in how much custom development we can provide through support. It's meant as a starting point to help guide you or a developer you might work with.

     

    Kind regards,
    Stefan

  •  1
    Michael replied

    Hi Stefan,

    I appreciate the effort you've already put in, thank you very much. I'll forward this to my developer and see if that sparks some ideas. Thank you again!