Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello all,
i just installed 7.x-1.x-dev version of commerce coupon module in my drupal commerce site.I created an 10% percentage discount and activated it.It got discounted from the order total when i loggedin as admin.
But when i use the coupon code as an anonymous user, it always throws an error "Coupon code is not valid".Can anyone please guide me to overcome this issue.
Thanks to all
Comments
Comment #1
pcambraIt is working for me as anonymous exactly the same as authenticated users.
Coupons are applied through rules, you can enable rules debug and post the results here, maybe the coupon code is not ok?
Comment #2
arun_ms CreditAttribution: arun_ms commented@pcambra, thanks for your reply.
I try to log the rules, but the coupon log gets creating only for admin orders and not for anonymous orders.I dont know what happen.
Pls guide me a solution.
Thanks
Comment #3
pcambraAs I said, this is working normally, so other than advising you to have the latest versions of both commerce and coupon modules, I'd need more info to help
Comment #4
arun_ms CreditAttribution: arun_ms commentedam using percentage coupon for my site. i uninstalled the coupon module and reinstalled it.It works only for admin not for anonymous and authendicated.
Please clarify me what exact info you need..
Thanks
Comment #5
arun_ms CreditAttribution: arun_ms commentedHello all,
i found the reason for coupon not working to anonymous users.i track the process of coupon execution.I found that "commerce_coupon_load_by_code" function returns empty value for anonymous users.
this function is in commerce_coupon.module file at line 534 , where the following query returns Empty value.
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'commerce_coupon')
->fieldCondition('commerce_coupon_code', 'value', $code, '=');
I dont know why this happening.Cananyone Please suggest me a solution for this.
Thank you all
Comment #6
esoteric1 CreditAttribution: esoteric1 commentedwhen you uninstalled and reinstalled did you look at the permissions for the modules?
Comment #7
Jason.bellmt CreditAttribution: Jason.bellmt as a volunteer commentedThank you for pointing me in the right direction. Permissions solved my problem with this
Comment #8
torgosPizzaGlad you figured it out!