Re: [spree-user] Promotion Code not working

262 views
Skip to first unread message

Ryan Bigg

unread,
Jan 6, 2013, 7:35:05 PM1/6/13
to spree...@googlegroups.com
This has long been a bane of the promotions system. We are wanting to find a fix for this as soon as possible.


On Sun, Jan 6, 2013 at 1:33 PM, Jason Miller <ja...@redconfetti.com> wrote:
I just installed Spree, and was experimenting with it to understand its features. I setup a promotion with a coupon code, then tried to use it with an order. Each time I attempted to use the coupon code it gave me the error "The coupon code you entered doesn't exist. Please try again."

I was informed by Hawth in the #spree IRC channel that orders created after a promotion has been created won't work. I cleared my cookies and tried again, and the coupon code was recognized as valid.

Just wanted to post this so someone else might find it in the future.

--
You received this message because you are subscribed to the Google Groups "Spree" group.
To view this discussion on the web visit https://groups.google.com/d/msg/spree-user/-/6yS5S91lP-gJ.
To post to this group, send email to spree...@googlegroups.com.
To unsubscribe from this group, send email to spree-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.

james

unread,
Jan 7, 2013, 7:02:26 AM1/7/13
to spree...@googlegroups.com
promotion.rb

    def order_activatable?(order)
      order &&
      created_at.to_i < order.created_at.to_i &&
      !UNACTIVATABLE_ORDER_STATES.include?(order.state)
    end

the line marked in red above is what causing this. I don't really see a business reason for that case though. If someone have a valid cart that is not submitted yet why shouldn't they be eligible for a promotion/coupon that is created few seconds later than their cart?

Nate Lowrie

unread,
Jan 7, 2013, 8:27:49 AM1/7/13
to spree...@googlegroups.com
I think the business case is one where the order has been placed but not shipped/payment collected.  You don't want to apply a promotion to an already placed order by accident.  I think we could inject an or clause into the statement to check for a cart status.

Regards,

Nate

james

unread,
Jan 7, 2013, 10:34:54 AM1/7/13
to spree...@googlegroups.com
UNACTIVATABLE_ORDER_STATES.include?(order.state)

above already take care of that I thought!

james

unread,
Jan 7, 2013, 10:38:24 AM1/7/13
to spree...@googlegroups.com
UNACTIVATABLE_ORDER_STATES = ["complete", "awaiting_return", "returned"]
Reply all
Reply to author
Forward
0 new messages