Ror ecommerce

Complete Ruby on Rails Ecommerce platform

Getting Started
Config
The Cart
Accounting
Addresses
Coupons
Deals
Fulfillment
Orders
Product Creation
Referrals
View the Project on GitHub drhenner/ror_ecommerce

This project is maintained by drhenner and many contributors.

ROR Ecommerce

Coupons

Coupons are straight forward. Picture a coupon you have in a grocery store. The only big difference in the grocery store you can have 30 coupon for different items you buy. For ror-e you can only have one Coupon for an entire order. This is pretty standard in the ecommerce world.

The method that is most important:

qualified?

This method does 2 things:

  1. it determines if the items in your cart cost enough to reach the minimum qualifing amount needed for the coupon to work.
  2. it determines if the coupon is "eligible?" (eligible? is a method)

The eligible? method changes functionality depending on what type of coupon is created.
=> at the most basic level it determine if the date of the order is greater than starts_at and less than expires_at

For first_purchase_xxxxx_coupons eligible? also ensures the order that this is being applied to is the first item you have ever purchased.

###################################################################
##  NOTE!!!  NOTE!!!  NOTE!!!  NOTE!!!  NOTE!!!  NOTE!!!  NOTE!!!
##  eligible? uses (order.completed_at || Time.zone.now)
##  thus being accurate for returned items and items being purchased right now.
###################################################################