Skip to content

ffl_woo_sync.woocommerce.variants

Source: apps/ffl_woo_sync/ffl_woo_sync/woocommerce/variants.py · 2 endpoint(s)

Generated by make api-docs — do not edit by hand.

adopt_variable_product

POST /api/method/ffl_woo_sync.woocommerce.variants.adopt_variable_product

Auth (derived from code): Roles: System Manager

Link a template to a variable product that already exists on the store, and

each variant to the variation whose SKU is its item code.

Afterwards, pushing the template updates that product and those variations; a variant with no variation there gets a new one, and a variation with no variant is left as it is (woo_only).

arg type required default description
template string yes — The template Item.
woo_product_id — yes — The variable product's id on the store.
site string no 'retail' "retail" (default; the only store).
dry_run — no 1 1 (default) only reads the store and reports; 0 writes the ids.

Returns: {ok, dry_run, template, product, matched, pos_only, woo_only, replaced}: matched is {item_code: variation id}; replaced the product ids the Items held before.

apps/ffl_woo_sync/ffl_woo_sync/woocommerce/variants.py:112

make_variants

POST /api/method/ffl_woo_sync.woocommerce.variants.make_variants

Auth (derived from code): Roles: System Manager

Make existing Items variants of a template, keeping their item codes.

Sets each Item's variant_of and its attribute values. Nothing is written when any Item fails a check (unknown Item, already another template's variant, missing or unknown attribute value, the same values as another requested Item or an existing variant).

An Item that is listed as its own simple product loses that link ({site}_product_id / listed cleared, returned in cleared): as a variant its id must be a variation of the template's product, so a stale simple-product id would be sent as a variation id. The simple product itself is left on the store — draft or trash it there, or link the variant to its variation with :func:adopt_variable_product.

arg type required default description
template string yes — The template Item (Has Variants on, with its attributes).
variants — yes — {item_code: {attribute: value}} (a dict or its JSON).
dry_run — no 1 1 (default) only checks; 0 writes.

Returns: {ok, dry_run, template, errors, variants, cleared}: variants is the item codes that are (or would be) variants of the template; cleared is {item_code: the simple product id it held} for Items that were not yet variants.

apps/ffl_woo_sync/ffl_woo_sync/woocommerce/variants.py:68