Drupal Commerce Blog

What's happening in the world of Drupal Commerce.

Commerce Module Tuesday: Commerce Recurring Framework

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.

Enabling the modules
We'll start by enabling the needed modules: Commerce Recurring, Commerce Recurring UI, Commerce Card on File Recurring, Commerce Card on File.

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.

Add and subscribe to your recurring product
Now you're ready to create your recurring product.

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

  • Initial Price: the price the user will pay for the first order.
  • 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!

Augustin Delaporte
Posted: Jun 18, 2013

Comments

richm on August 21, 2013

Great screencast!

Could you please provide some guidance (possibly a tutorial) as to how to add rules to calculate and add shipping charges and sales taxes to the recurring order.

Thanks.

enorniel on October 3, 2013

Hello,

I have a recurring product with an initial period and a recurring period (I don't need the other fields).

When I buy one, the payment is done but the recurring payment no. I have the error in the title inside the order.

I use paymill also. Do I have to modify a rule or something ?

Thanks.