solidus
https://github.com/solidusio/solidus
Ruby
🛒 Solidus, the open-source eCommerce framework for industry trailblazers.
Spree::StockLocation#stock_item_or_create
Attempts to look up StockItem for the variant, and creates one if not found. This method accepts an id or instance of the variant since it is used in multiple ways. Other methods in this model attempt to pass a variant, but controller actions can pass just the variant id as a parameter.
Edit
git clone [email protected]:solidusio/solidus.git
cd solidus
open core/app/models/spree/stock_location.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Spree--StockLocation-stock_item_or_create-for-pr
# Commit to gitgit add core/app/models/spree/stock_location.rbgit commit -m "better docs for Spree::StockLocation#stock_item_or_create"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Spree--StockLocation-stock_item_or_create-for-pr
hub pull-request
# Celebrate!