1

For a current site I am building, authenticated users should be able to order 2 free products (of a certain type), after which the prices are back up to full price. Is there any solution which allows this kind of functionality? I can't seem to find the right words to search as nothing is coming up.

If not, any ideas on how to implement this with Rules / code?

I imagine I would have to add a new line item for the 2 free tickets at $0, and deduct these 2 products from the original line item, but I'm not sure at what stage in the process to do this. Any help?

  • You might be able to achieve something with Commerce Discount and give 100% discount on the first 2 products? I guess that would be easier than working with new line items. – Neograph734 Aug 31 '17 at 8:51
0

By using the Goals module (disclosure: I'm its maintainer) you can have the Rules module take care of "monitoring users about buying their first 2 products" (as in your question). The advantage of using the Goals module, is that you can keep track of all sorts of events that are happening asynchronously (which you cannot do by only using Rules and its events).

So with that it seems that your question (challenge) is reduced to finding a way to configure the appropriate set of Goals and related Tasks. For a basic introduction about Goals, have a look at:

Here is what it would take to implement something like a frequent buyers program:

  1. Goal = "New customer", with only 1 Task = "Buy 1 product" (say with machine name = buy_product).
  2. Goal = "Existing customer", with Task = "Buy 2 products".

The interesting part of this is that you'd only have to write 1 rule (related to that machine name = buy_product) to keep track of the progress of any user to become either a "new" or "existing" customer (check the video for a similar sample).

Homework: how should a rule look like to indicate that a user bought a product (either the very first one, or yet another one)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.