We had a session on Commerce Stock at the Brighton Drupal Weekend: http://badcampuk.net/

Here are the notes.

=================================
Guy Scheerson's session on Entity
=================================

What if you want to create a wish list?

... a back-order is a better example.

e.g. a book which is out of stock.

it's an order but not really

so do we need a different kind of order?

an order has different states: a regular order can go to completion.

a line-item for a wish-list item is a different kind of line-item.

... a pre-order item as opposed to an instock item.

what about a single order with different kinds of line-item.

another order to be created from the unfulfilled line-items.

loop through line items

... find unfulfillable line-items
... create a new order out of these with a different state.

this is a possibility. use rules for this.

amazon has deliver these items as they become available.
it stays a single order from the point of view of the user.
... in this case a payment is taken for the entire order, so it's different from the wish-list case.

ben.
three states of order in the real world.

* order
* back-order
* notify-when-available

guy.
maintains the stock module
... responds to the add to cart event
for form build, for clicking it and at various places in the checkout process.

out of the box
... allows us to disable add to cart form if the product is out of stock.

up to thursday this is all it could do.

now.
new action.
adv config of add to cart form

* normal submit
* url action
* custom submit
* custom html

example: url action
url: "out of stock, let me know when in stock"

many people are asking for the ability to notify-when-available.

if this thing comes back into stock, I want to be first in line.

ben.
at set-up time the vendor has to mark the products as:

* guaranteed-available
* possibly-available

when ordering a domain name.
line-item has a field domain name: google.com
on 'add to cart'
we check if the thing is in stock.
that's the event we use.

3 events:
1 building of the form
2 adding to the cart - when we click the button
3 validate the entire cart --- when you click the checkout link

product-level validation happens on 1,2
validation happens on 3 --- actually event happens once for each line-item

ben.
would like to be able to declare an api call on the event.

guy.
stock module is a little bit of a misleading name.
it occupies a greater functionality space in reality.
it controls what happens to a product through the checkout process.
in the add-to-cart and checkout process.

another way of simplifying it is:
if you think of a product as a sku
stock module implements hooks that are available from drupal commerce.
controls aspects of its physicality which are not connected to payment.

stock also manages where stuff is stored.
what happens when stock comes in?
ability to move stock around.

ben.
build a point of sale system

same system both for online and instore sales.

square 1 inch plastic square.
scans and swipes a credit card.
squareup.com

guy.
using ip-location with drupal commerce

Comments

guy_schneerson’s picture

great work @michaellenahan
I have added a link from the roadmap to this issue

In short the way i see it we have 4 use cases:

1) back-order case 1 - An item not currently in stock to delivered when it becomes available.
Users pay for all items including back-order and those gets shipped when become in stock

2) back-order case 2 - An item not currently in stock to be sold/paid and delivered when it becomes available.
Users pays only for in stock items and gets charged only when items go back in stock.

3)notify-when-available case 1 - notify me when an out of stock item is back in stock

4) notify-when-available case 2- give priority if back in stock
Some users requested this. Its a hybrid of back-order and notify-when-available. where user dosen't have an order but the has a "line item" like entity that's pre reserved for him and can later be converted to a line item in an order.

Techniques that should be looked at

1) Use a new order bundle
2) Create other line item collections ("node q" is an option)
3) Extend the line item to include state information - e.g. order can contain in-stock and back-order items
4) Stock should not be a single value but collection of: stock Level, State, Location

guy_schneerson’s picture

Title: Notes from our session in Brighton » Notes from our Sep 2012 session in Brighton
guy_schneerson’s picture

Issue summary: View changes

Updated issue summary.