Repository navigation
[5.x] quicker method of entering stock per variant #3429
Replies: 2 comments
|
+1 |
|
We are looking into this for the future. In the mean time here is a guide to do this with a custom field: You would make a number input field as a normal custom field first, and add it to your variant field layout. In my example I called it Then set up a module in your project: https://craftcms.com/docs/5.x/extend/module-guide.html I have then made a example module: https://github.com/proxy/gist.github.com/lukeholder/20ba12ace29509daa847ec7c7ec04c7d The module example above syncs a custom CP edit form loads — reads the current available stock from the variant's store's first inventory location and pre-populates the easyStock field, so the editor always sees the live stock value. Variant is saved — takes whatever value was submitted in easyStock and sets it as the available quantity on the inventory level for that same location. If the field is blank, it leaves inventory untouched. In effect it gives editors a single "stock" number field on the variant form that reads from and writes to Commerce inventory, without them needing to open the modal to update the stock number. If you only have one variant, you could add the field to your product field layout, but you would need to update the module code to work from that perspective. Hope that helps. |
Uh oh!
There was an error while loading. Please reload this page.
In Commerce 5, it would be nice if there was a faster way to edit stock for variants. Now you have to go through all of these steps:
I miss the Commerce 4 way where stock was just a field. Entering all variants and stock for a product becomes a pretty hard task in Commerce 5.
All reactions