Ubercart

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:

<?php
// 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
uc_recurring_fee_cancel($fee->rfid);
}
?>

Drupal 7 'Add to Cart' Rule for Ubercart

On a current site in development I am using Ubercart to provide a renewable subscription service. To make the user experience clean, I wanted to protect the user from going 'shopping' to add their subscription. To do this I decided to use a rule to add the product to the user cart when the user is created by an administrator or when the subscription is cancelled or fails payment. I tried the Ubercart Rules module, but this is mainly for dealing with orders and not carts, and did not contain the needed add to cart rule.

Syndicate content