TIPOFF / checkout

Laravel Package for Ecommerce Checkouts
MIT License
0 stars 1 forks source link

Cart Item #35

Closed drewroberts closed 3 years ago

drewroberts commented 3 years ago

Sellable Items that belong to a Cart #34

sl0wik commented 3 years ago

Cart Item could have sellable_type with sellable_id referencing to model that must have Sellable interface.

drewroberts commented 3 years ago

Yes, that is in issue #28 and will also be included in Order Item #33

pdbreen commented 3 years ago

I'm leaning towards something close - but slightly different. The root of sellability is a product, the root table of which has very basic info (maybe just "sku") along with the morph to the sellable thing (physical product, booking, etc). The product id is then used by cart item, order item, etc. More details in notion soon.

(edit -- keeping the morph in the product realm in exchange for a product id prevents having to propagate the morph fields every where you're dealing it later on).

pdbreen commented 3 years ago

After some experimentation, I think it may be too far a leap to move immediately to catalog | product | inventory concepts. So, it is now looking like CartItem (and OrderItem) will contain a morph to sellable. The transition from CartItem => OrderItem will allow for the CartItem sellable to be replaced with a different OrderItem sellable, but it won't require it. This could allow for one type of model/DB table to be used during checkout and a different model/DB table to handle things after the order is created.

drewroberts commented 3 years ago

Thank you. I like this approach. Let's move forward with it.

drewroberts commented 3 years ago

Sellable Trait - Issue #28

pdbreen commented 3 years ago

Added as a morph to a model implementing the Sellable interface.

https://github.com/tipoff/checkout/blob/main/database/migrations/2020_05_05_060000_create_cart_items_table.php https://github.com/tipoff/checkout/blob/main/src/Models/CartItem.php