Vote up!
Vote down!

A rule to force to buy a product-type when you buy another product-type

Hi there,

I am stuck with a problem.

We sell phone numbers (VOIP). When a client buys a phone number, he must buy call credits.

There are many phone numbers (each one of theme is a product corresponding to a product-type). There are 4 different call-credits (corresponding to the "call-credit" product-type).

So for each VOIP number that the client buys, he must add a call credit of his choice (from 29 to 99 euro).

But I can't manage this... The system should look in the cart before the paiement if every DID has its corresponding Call-credit. You could set it as an option for the VOIP number but no! Because the VOIP number is -of course- a recurring product...

Is there a genius that could help? :-)

Thanks in advance.

Asked by: fredbest
on July 31, 2012

1 Answer

Vote up!
Vote down!

You need a rule which requires certain call credits if they have a certain phone number. Or. more generically, one product type requires another product type. Additionally, you need checkout to fail if that criteria is not met.

I would recommend you run on the action "After adding a product to a cart"

See this rule that requires a particular product be in an order: http://pastebin.com/w5Shxvib

Something like the above, but check that the line-item that is being added is the correct product type.

Josh Miller
Answer by: Josh Miller
Posted: Sep 5, 2012