{"slug":"compare-delivered-carts","title":"Compare checkout totals after shipping and discounts","label":"Checkout comparison","description":"Compare supplied carts with exact amounts, preserve unknown shipping or tax, and avoid choosing a winner from item prices alone.","problem":"The same item costs $18 at one checkout and $22 at another. With supplied shipping, discounts and tax, their totals become $25.49 and $22.50. These fictional snapshots demonstrate why the lower item price can lose. Confirm that carts meet the same requirements before comparing them.","steps":[{"tool":"commerce.price-components","title":"Reconcile lower-item-price","text":"Send this supplied snapshot as one separate call. Inspect total, missingComponents and any declared-total mismatch. Missing shipping, tax or fees must stay null; never replace an unknown cost with zero.","sampleInput":{"currency":"USD","minorUnitDigits":2,"items":[{"id":"identical-item","unitPrice":"18.00","quantity":1,"discount":"0.00"}],"orderDiscount":"0.00","shipping":"5.99","tax":"1.50","fees":"0.00"}},{"tool":"commerce.price-components","title":"Reconcile free-shipping","text":"Send this supplied snapshot as one separate call. Inspect total, missingComponents and any declared-total mismatch. Missing shipping, tax or fees must stay null; never replace an unknown cost with zero.","sampleInput":{"currency":"USD","minorUnitDigits":2,"items":[{"id":"identical-item","unitPrice":"22.00","quantity":1,"discount":"0.00"}],"orderDiscount":"1.00","shipping":"0.00","tax":"1.50","fees":"0.00"}}],"exampleScope":"Fictional checkout snapshots shared with the downloadable recipe. Sample inputs are not live merchant offers or customer activity.","recipe":{"url":"https://agent-utilities.agent-utilities.workers.dev/downloads/compare_carts.py","inputUrl":"https://agent-utilities.agent-utilities.workers.dev/downloads/cart_comparison_example.json","guideUrl":"https://agent-utilities.agent-utilities.workers.dev/integrations/python#compare-carts","preview":"python3 compare_carts.py","scope":"Default preview only validates and prepares requests offline; --execute authorizes paid service-credit calls. Supply 2–10 comparable carts. Default total ceiling is 1000 micro-dollar credits for two carts."},"outcome":"For these complete supplied snapshots, free-shipping has the lower total at $22.50, versus $25.49. Compare exact minor-unit integers in one currency and retain ties. Any incomplete candidate prevents an overall winner, even when other carts have known totals. A declared-total mismatch needs review. These are supplied-data calculations, not live quotes, tax advice, product-equivalence checks or orders. Each successful cart reconciliation is separately billable; preserve every prepared input and request ID before execution and recover uncertain calls without creating new IDs.","url":"https://agent-utilities.agent-utilities.workers.dev/use-cases/compare-delivered-carts","apiUrl":"https://agent-utilities.agent-utilities.workers.dev/v1/content/workflows/compare-delivered-carts","estimatedMicroUsd":1000,"pricingScope":"One successful call per listed step. Each call bills separately; check current prices before executing."}