Set stock to zero using a saved product field
stock_zero_search is an optional safeguard for a product import. It checks a field already saved on each matched SureDone product. When that field is YES, the import sets that product's configured stock field to zero instead of the incoming quantity. Other mapped fields and warehouse values are not changed by this setting.
For example, suppose you have a saved text field called supplierblock. This file-configuration fragment checks that field while updating products:
{
"field_map": {"guid": "supplier_sku", "stock": "quantity"},
"update": "edit",
"stock_field": "stock",
"stock_zero_search": "supplierblock:=YES"
}
This is a fragment rather than a complete automation. Set up and populate the saved supplierblock field first, and adapt the incoming column names to your file. The check matches YES without regard to letter case. Missing, empty, and other values do not match. The supplier's incoming quantity is not the field being checked.
Supported settings
- The only nonempty condition is one stored field name followed by
:=YES, with no spaces or additional conditions. General search expressions, grouped conditions, and comparisons to another field are not supported. - Use a product import with
update: "edit"orupdate: "relist". Bulk-file passthrough, orders, fitment and exports do not support this setting. - Set
stock_fieldtostockor an existing concrete numeric custom field. It must differ from the field in the condition. The condition itself must refer to a stored field, not a derived or nested field. - If
diff_fieldsis nonempty, include the stock field and do not includeguid. Do not combine this option withdiff_toleranceor anignoreValue/ignoreFieldaction on the stock field. - SureDone actions that would change an identifier before matching are not supported when this option is enabled. This restriction applies across the automation's file configurations. Vendor-side identifier actions and ordinary actions after matching remain available, subject to their own rules.
The mask is applied separately to each product actually matched, after ordinary actions and formatting and before the change comparison. A match can therefore receive zero even when its mapped stock value is blank or malformed. If the output contains no stock field at all, this option does not create one; a missing source column can leave an existing quantity unchanged. Verify that your supplier's file contains the expected column.
Before enabling
Test with representative products that have YES, another value, and a missing flag. Include duplicate supplier identifiers if your catalog uses them, and check each matched product's resulting stock. Verify full and differential runs with the source file you expect to receive. Ensure the automation's normal missing-item behavior is appropriate for an incomplete file.
The decision uses the product values available when that run reads them. Changing the saved flag after a run has read it does not change output already produced or queued. A later run reads the newer value, but this setting does not order concurrent updates or repair previously queued output. Check the final saved stock and any affected channel separately; turning the setting off does not reverse earlier updates.