Commerce Billy introduce a new order state & status: "Invoiced".

The list of state which this module consider valid to mark the coupon as used is hardcoded, invoicing the order means decrement the usage count of the coupon (which is obviously not wanted).

From commerce_coupon_usage.module :

  $statuses = array_merge(commerce_order_statuses(array('state' => 'completed')), commerce_order_statuses(array('state' => 'pending')));

Comments

garphy created an issue. See original summary.

garphy’s picture

Title: Status "Invoiced" of Commerce Billy removes the usage transaction. » Integrate Commerce Coupon Usage with Commerce Billy
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new695 bytes

Here's a patch which integrate Commerce Coupon Usage with Commerce Billy

hugronaphor’s picture

Status: Needs review » Reviewed & tested by the community

This worked for me.
Thanks

mglaman’s picture

Status: Reviewed & tested by the community » Needs review

At some point drupal_alter('commerce_coupon_usage_tracked_order_statuses', $statuses); was added.

/**
 * Alter the list of commerce_order statuses where the coupon should have its
 * usage tracked.
 *
 *  @see commerce_coupon_usage_tracked_order_statuses().
 */
function hook_commerce_coupon_usage_tracked_order_statuses_alter(&$statuses) {
  $statuses[] = 'shipping_in_progress';
}

I honestly feel it should be up to Commerce Billy to invoke this alter to add its statuses. Willing to hear feedback. Before there was no hook.

reszli’s picture

Status: Needs review » Reviewed & tested by the community

the new hook was introduced in RC4
and since it's a hook, I would agree that it's implemented by commerce_billy
so I created an issue there: #2895589: support Commerce Coupon's usage stats

mglaman’s picture

I'm willing to commit this, afterall. We have a proper issue opened in Billy; we can clean this up if that ever makes it. I'd like to help people not need patches over "what's the right way" over this one.