Set a trolley line's quantity
set_cart_quantitySet a product's exact quantity in the Woolworths trolley, adding or removing the line. Handles weight-based items and returns the actual applied quantity when the site adjusts it.
Instructions
Set one product's trolley line to an exact quantity, adding it if absent. Quantity is absolute, not a delta: the value you pass becomes the line's new quantity, and 0 removes the line. For pricingUnit, use the product's purchasingUnit field from search_products or get_product verbatim — it is 'Each' or 'Kg'. Only pass 'Kg' with a decimal quantity when the product's canBuyByWeight is true; sending 'Kg' for a counted item orders a kilogram of it. Returns requestedQuantity and appliedQuantity separately, because Woolworths silently substitutes its own quantity for some products (0.3 Kg of loose bananas becomes 0.5 Kg). When adjusted is true, adjustment says what the site did instead — report the applied amount to the shopper, never the requested one. Also returns trolleyTotalQuantity (quantities summed across the whole trolley, not a line count). To change several products, use set_cart_quantities instead. Needs a signed-in session; run npm run login where the server runs, or call sign_in for the details.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sku | Yes | Woolworths product SKU, from search_products. | |
| quantity | Yes | The line's new absolute quantity. 0 removes it. Decimals only for Kg. | |
| pricingUnit | No | 'Each' for counted items, 'Kg' for items priced by weight. | Each |