Not sure if this is a Coupon or Braintree issue.

When I have the Commerce Braintree module enabled, the Coupon module throws this error:

Warning: array_unshift() expects parameter 1 to be array, null given in commerce_coupon_form_commerce_checkout_form_alter() (line 2120 of /var/www/drupal/sites/all/modules/commerce_coupon/commerce_coupon.module).

This error persists in the latest dev version of the module (7.x-2.0-rc2+14-dev):

Warning: array_unshift() expects parameter 1 to be array, null given in commerce_coupon_form_commerce_checkout_form_alter() (line 2136 of /var/www/drupal/sites/all/modules/commerce_coupon/commerce_coupon.module).

When I disable the Commerce Braintree module and enable a different payment method, this error doesn't occur.

CommentFileSizeAuthor
#2 2798995-2.patch704 bytestuutti

Comments

millionleaves created an issue. See original summary.

tuutti’s picture

StatusFileSize
new704 bytes

I'm having the same issue. Here's a patch that seems to fix it.

tuutti’s picture

Status: Active » Needs review
scotwith1t’s picture

Status: Needs review » Reviewed & tested by the community

Seems to work for me. I ran into this after enabling braintree as well. I think the coupon module is forgetting about the possibility of going to the Payment pane after review?

mglaman’s picture

Seems to work for me. I ran into this after enabling braintree as well. I think the coupon module is forgetting about the possibility of going to the Payment pane after review?

True. It's generally assumed that the payment pane is on the review page. This validation hook in seems to deal with the gift card module, and fact it piggybacks on coupons

  // Whenever the payment pane loads, check the order for any transactions that
  // might need to be rolled back. This is to handle when giftcard validation
  // was successful but the payment method or some other form element has thrown
  // an error.

I'm fine committing the fix for extra validation. It seems that this is very specific when reviewing code comments for this validation hook.

  • mglaman committed 85f893e on 7.x-2.x authored by tuutti
    Issue #2798995 by tuutti, scotself: Error when the Commerce Braintree...
mglaman’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.