Drupal 7 Ubercart Recurring Payment Cancellation Rule

For a current Drupal 7 project that uses Ubercart and Ubercart Recurring to provide for a subscription service, I need the ability for an admin user to be able to cancel a user's ongoing recurring fee when a subscription level is changed. I accomplished this with the following php rule:

// load all recurring fees for a user
$recurring_fees = uc_recurring_get_user_fees($user_uid);
// loop through fees
foreach ($recurring_fees AS $fee) {
// cancel each fee

I tied this in with a rule to clear the user's cart and another rule to add the new subscription to the user's cart.

Anyway ... I have included an export of the component for ease of import.

cancelusersubs.txt614 bytes


Post new comment

  • Allowed HTML tags: <em> <strong>
  • Lines and paragraphs break automatically.

More information about formatting options

Enter the characters shown in the image.