Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

"First Order" promo rule doesn't work in Spree 1.3.2 #2833

Closed
linrock opened this Issue Apr 6, 2013 · 5 comments

Comments

Projects
None yet
3 participants

linrock commented Apr 6, 2013

Steps to reproduce:

  1. Create a new Rails 3.2.12 app and install Spree 1.3.2 with seed data
  2. Create a promo code with event name "coupon code added" and a rule of type "first order"
  3. Create a new user, log in, and add an item to cart
  4. On the cart page, attempt to use the promo code created in step 3
  5. An error shows up saying "This coupon code is not eligible for this order"

If the promo code doesn't have a "first order" rule, it gets applied properly.

Member

huoxito commented Apr 8, 2013

@linrock I believe this was fixed in 5af978f. Please try applying that patch or point to 1-3-stable to confirm the issue is resolved.

linrock commented Apr 8, 2013

Thanks @huoxito, with 1-3-stable (and Rails 3.2.13) I can confirm that the promo code works if I attempt to use it while already logged in as a new user, but I'm running into an issue where if I attempt to use the promo code while not logged in, it doesn't get applied, and then I can't use the code even after logging in.

Here are the steps:

  1. Create a promo code with event name "coupon code added" and a rule of type "first order" (with valid usage limit and date range).
  2. Log out and add an item to cart. On the cart page, attempt to use the coupon code from step 1.
  3. You should see the error message "This coupon code is not eligible for this order", which is expected since you're not logged in. However...
  4. Create a new account. The same item is in the cart, and you're logged in now. Attempt to use the coupon code from step 1.
  5. The same error message from step 3 shows up and the code is not applied. The code also won't work with successive attempts to use it.

An edge case:

After step 5, if I attempt to use a different promo code of lesser value (set up the same way as step 1), the same error message shows up, but the adjustments shows the promo code from step 1 as being applied, and the subtotal doesn't reflect this adjustment. After refreshing the page, the cart will show that the code from step 1 was successfully applied.

Member

huoxito commented Apr 9, 2013

true @linrock I could confirm that issue. This one is tricky.

In fact the adjustment is created, I guess on the first time you submit the promo code. As you noticed the eligibility is not updated as it should when you log in and enter the code again.

Adjustments eligibility are usually updated only when the order object receives update! Following the example you described above, to make the adjustment count you'd need to change the order somehow, either by increasing the item quantity or by adding new items to the cart.

I think Spree frontend should not display the coupon field on the cart page if the user is not logged in or if there's no email attached to the order. That should avoid the issue as far as I can see right now. Anything beyond that might be too complex. Interesting issue though

linrock commented Apr 10, 2013

Thanks, I think what you suggest about hiding the coupon code field on the cart page when the user isn't logged in works well enough for avoiding these issues.

Member

radar commented Nov 28, 2013

Closing as this issue is rather old and we have fixes for that in more recent versions of Spree.

@radar radar closed this Nov 28, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment