Skip to content

Instantly share code, notes, and snippets.

@knewter
Created August 10, 2012 16:48
Show Gist options
  • Save knewter/3315499 to your computer and use it in GitHub Desktop.
Save knewter/3315499 to your computer and use it in GitHub Desktop.

Spree Checkout Fakery

We want to use spree to manage inventory/products, but our app uses funny money and needs to override checkout.

Ordering a product is a one-step process. Click a button, order fulfilled. My plan is as follows:

On button click:

  • Create a cart.
  • Add the product to the cart.
  • Specify my own address bits to handle fulfilment.
  • Push the order through all of its state machine, step by step. I won't skip any, I'll just do them all in one action. (this will be in a plain ol' ruby object that handles all of this)
  • Redirect the user to my own 'hey guy good job!' success page.

I will make this happen by decorating the OrdersController#populate method.

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