I've got a Commerce 3 store where the customer maintains the majority of the product listings by updating a Google Sheet, very few fields are edited via the Control Panel.
However, now they are starting to do pretty simple inventory control for some products we are running into issues.
Right now I set the inventory to unlimited via the Google Sheet for all products, and that works fine, until you want to import a product with inventory control.
The issue is, if you enable inventory control for a product in the sheet, then import it, the import will fail ever time unless you supply a value for Stock on hand.
We don't want to be setting stock on had via the sheet however, so we are a bit stuck.
The question here really, is there any way to import a value from the sheet only if a value doesn't already exist in the entry for stock on hand?
Here's an example of where this breaks down:
Import a new product with Unlimited set to 0, the import will fail because Stock is a required field.
If I include stock in the spreadsheet I'll get bad data as it will overwrite the stock levels with each subsequent import.
I've played around with default field values on this with the intent of setting a value of 0 if there was no preexisting value, however, this will overwrite any value already in Commerce.
Ideal world we would run the import, any new items would have Stock set to 0, which would then be updated manually after the import, but subsequent runs would leave stock levels alone.
My idea is to enable parseTwig and create a simple conditional to set this value if it's null, but I can't find much in the way of documentation on this feature to connect all the dots.
Last resort being a plugin.