Okay
  Public Ticket #3814659
New group rule condition
Closed

Comments

  • Dominik started the conversation

    Hello,
    I would like to create a new condition in group rules that will keep track of the order value in the current year and always reset itself every new year. is there any way to do this? My client is requesting these rules for his loyalty program

    Thank you

    Sincerely

    Dd

  •  2,330
    WebWizards replied

    Hello Dominik,

    Thank you for purchasing our plugin,

     

    Could you please share an example here to make sure that I'm understanding this correctly?

    Is the idea to keep changing the group based on various group rules, and then on 1 January move all users to the base group and reset the "total order value" calculated for them?

    It would help a lot if you can share an example so we can think about the best way to achieve that. We are open to adding a new group rule or providing you with a code snippet to help achieve this.

     

    Kind regards,

    Stefan

     

  • Dominik replied

    Hello,

    thank you for your reply. 

    The idea is that the plugin tracks the total value of orders for the current year and for the following year it restarts and the customer is back in the base group and goes again. 

    For example:
    A customer is shopping on our store in the current year. At one moment his orders exceed the value of, say, 5000 CZK and the system moves him to a better group, then his orders exceed 50 000 CZK and again he moves from this group to a better one, etc. And as soon as it is a new year, all this is reset, the customer is in the basic group and goes from the beginning. Also the system needs to be able to, if a customer is in the basic group and buys straight for 50 000 CZK, to move him straight to the better group.

    I hope this is clear

    Thank you very much 

    Dominik


  •  2,330
    WebWizards replied

    Hi again,

    Thank you for confirming and clarifying that.

    I have written the following code snippet which can be added to the site to functions.php or to any snippets plugin: https://pastecode.io/s/7jqio4pt

    In this code snippet, 1234 should be replaced with the group ID of the base group. To get that ID, edit the group and the number in the URL such as ?post=123 is the ID of the group. The snippet will automatically reset all customers to this base group on 1 January of each year.

     

    Then under B2BKing -> Group Rules, you can create rules using the "total spent" condition:

    4728437699.png

    The above code snippet modifies how these rules work, making them only count the total spent during the current year.

     

    Kind regards,

    Stefan