I'm having the following error messages in the watchdog, when tying to use a coupon with a max_usage=1 condition attached to a discount.

Warning: unserialize() expects parameter 1 to be string, array given in commerce_coupon_evaluate_inline_conditions() (line 592 of /sites/all/modules/contrib/commerce_coupon/commerce_coupon.module).

The and AND () fails the integrity check and cannot be executed. Error: Missing configuration for parameter max_usage.

Required parameter max_usage is missing.

Unable to evaluate condition commerce_coupon_usage_evaluate_usage.

the following lines seem to be the cause of the problem:

$condition_settings = array();
$condition_settings[] = unserialize($value['condition_settings']);
// Build the condition parameters and add the condition.
$parameters = array('entity:select' => $condition['entity type']) + $condition_settings;
$rule->condition($value['condition_name'], $parameters);

since the $value is not serialized at this stage, replacing these lines as follows seems to solve the problem for me:

$parameters = array('entity:select' => $condition['entity type']) + $value['condition_settings'];
$rule->condition($value['condition_name'], $parameters);

Comments

reszli created an issue. See original summary.

reszli’s picture

reszli’s picture

Issue summary: View changes
janvonmulert’s picture

Had the exact same issue, tried the fix above, and it didn't help.

But..... I was trying to check out as anon, and allowing "Redeem Any Coupon" for anonymous in permissions fixed this.

What a terribly unhelpful error message!