Drupal Commerce Blog

What's happening in the world of Drupal Commerce.

Commerce Module Tuesday: Commerce Recurring Framework

Welcome to another Commerce Module Tuesday! Today we are looking at Commerce Recurring Framework, maintained by Pedro Cambra (the screencast is about the new and highly anticipated 2.x branch). We will go through setting up a healthy recurring bill that would have your Commerce Kickstart 2 site sending out $7 toothbrushes once a month.

After the video, we include a run down of the steps mentioned in the video.

Create a content type
Commerce Recurring provides a Recurring Product product type (known in Kickstart 2.x as variation type). The easiest way to display a product of that type is to create a content type which will reference the Recurring Product product type.

So we create a Toothbrush content type and add a product reference field which only targets Recurring Product product types.

Recurring Price: the price the user will pay for each recurring order.

Price: the default Commerce price which can't be deleted.

You'll also notice that you've 3 fields for the period:

Initial Period: the period after which the recurring subscription will start.

Recurring Period: the period of the recurring subscription.

End Period: the period after which the recurring subscription will end.

Wait for the recurring subscription to start
On that screencast, I manually edited the initial period to make it start directly. Once I run the cron, a rule is triggered and updates all the pending recurring orders with the status Pending (Recurring order).

And when I run cron (again...), another rule is triggered to charge all the orders with the Pending (Recurring order) status using the attached credit card.

Play with the rules
Now it's your turn ! Feel free to edit any of the rules to manage your recurring subscriptions on your site...

Comments or thoughts on what Commerce Module we should feature in next week’s Commerce Module Tuesday? Let us know in the comments!