api.scripts.update_product¶
Brings a Model’s existing Shopify product in line with Airtable, the source of truth.
Takes a Variation id (record_id) or a Model id (model_id): a Model is one product. Everything is written through api/services/shopify_products.py: only what differs from the live product, so a product in sync costs one read. Lenient: a missing photo or a refused stock update is reported as a failure once everything else was written.
to_sell_on_shopify “Non” deletes the product and its “Annonces Shopify” records; empty fails without touching anything.
A variant with nothing left to sell is deleted; when the whole Model has nothing to sell, the variants stay, at 0 stock: the product stays listed.
The status comes from the “Annonces Shopify” record; empty keeps the live one. An empty Airtable value never clears anything on Shopify.
The documentation PDF follows the Model’s “Documentation” (api/scripts/_product_documentation.py).
Runs for one Model never overlap: a run that finds the Model’s lock held is requeued, and reads Airtable only once it holds the lock.
Attributes¶
Classes¶
Module Contents¶
- api.scripts.update_product.logger¶
- api.scripts.update_product.VALID_SHOPIFY_STATUSES = ('active', 'draft', 'archived', 'unlisted')¶
- class api.scripts.update_product.UpdateProductScript¶
- name = 'update_product'¶
- schedule = None¶
- requeue_when_locked = True¶
- is_configured() bool¶
- run(previous_snapshot: dict[str, Any] | None = None, report_stage: api.scripts.base.StageReporter = lambda stage: ..., **kwargs: Any) tuple[api.scripts.base.ScriptResult, dict[str, Any] | None]¶