api.scripts.update_product ========================== .. py:module:: api.scripts.update_product .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: api.scripts.update_product.logger api.scripts.update_product.VALID_SHOPIFY_STATUSES Classes ------- .. autoapisummary:: api.scripts.update_product.UpdateProductScript Module Contents --------------- .. py:data:: logger .. py:data:: VALID_SHOPIFY_STATUSES :value: ('active', 'draft', 'archived', 'unlisted') .. py:class:: UpdateProductScript .. py:attribute:: name :value: 'update_product' .. py:attribute:: schedule :value: None .. py:attribute:: requeue_when_locked :value: True .. py:method:: is_configured() -> bool .. py:method:: run(previous_snapshot: dict[str, Any] | None = None, report_stage: api.scripts.base.StageReporter = lambda stage: None, **kwargs: Any) -> tuple[api.scripts.base.ScriptResult, dict[str, Any] | None]