{"product_id":"n8n-workflow-compare-supplier-quote-subtotals-with-javascript","title":"n8n Workflow: Compare Supplier Quote Subtotals with JavaScript","description":"\u003ch3\u003eCompare Supplier Quote Subtotals with JavaScript in n8n\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow takes multiple supplier quotes for the same quantity and currency, validates the inputs, calculates goods\/freight\/setup subtotals, and ranks suppliers by the lowest quoted subtotal—using JavaScript Code nodes for transparent, audit-friendly calculations.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRuns on manual execution\u003c\/strong\u003e (Manual Trigger) so you can test and rerun with your own data.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eLoads a sample JSON payload\u003c\/strong\u003e containing the required \u003cem\u003equantity\u003c\/em\u003e, \u003cem\u003ecurrency\u003c\/em\u003e, and an array of \u003cem\u003esupplier quotes\u003c\/em\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eValidates quote consistency\u003c\/strong\u003e:\n    \u003cul\u003e\n      \u003cli\u003eEnsures every quote uses the \u003cstrong\u003esame currency\u003c\/strong\u003e and \u003cstrong\u003esame quantity\u003c\/strong\u003e.\u003c\/li\u003e\n      \u003cli\u003eVerifies \u003cstrong\u003eunique supplier names\u003c\/strong\u003e.\u003c\/li\u003e\n      \u003cli\u003eChecks that monetary amounts are \u003cstrong\u003enonnegative integers\u003c\/strong\u003e and the \u003cstrong\u003edeposit percentage is 0–100\u003c\/strong\u003e.\u003c\/li\u003e\n    \u003c\/ul\u003e\n  \u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCalculates key totals per supplier\u003c\/strong\u003e, including goods cost, freight, setup, overall subtotal, and \u003cstrong\u003esubtotal per unit\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eComputes a goods-only deposit amount\u003c\/strong\u003e based on the provided deposit percentage.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSorts suppliers\u003c\/strong\u003e by the \u003cstrong\u003elowest quoted subtotal\u003c\/strong\u003e and outputs a report, including \u003cstrong\u003eties\u003c\/strong\u003e for the lowest subtotal.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eProcurement teams comparing vendor quotes for the same order quantity and currency.\u003c\/li\u003e\n  \u003cli\u003eSaaS operators standardizing quote calculations and reducing manual spreadsheet errors.\u003c\/li\u003e\n  \u003cli\u003eAutomation engineers validating quote JSON payloads before downstream approvals or purchasing decisions.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNodes\/tech stack:\u003c\/strong\u003e Code (JavaScript), Sticky Note, Manual Trigger\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSetup requirements:\u003c\/strong\u003e Import the workflow and run the fictional example first. Inspect the calculation step, then replace \u003cstrong\u003eExample input\u003c\/strong\u003e with your normalized quotes.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eMoney format:\u003c\/strong\u003e Provide values as \u003cstrong\u003einteger minor units\u003c\/strong\u003e (e.g., GBP: 420 means GBP 4.20). Include freight and setup explicitly, using \u003cstrong\u003ezero only when actually zero\u003c\/strong\u003e.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46067969392819,"sku":"N8N-19779","price":37.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/ZCQ-KmBAzSI6A959giaoL_sz3n4xcW.png?v=1789981490","url":"https:\/\/buyflowscripts.com\/products\/n8n-workflow-compare-supplier-quote-subtotals-with-javascript","provider":"N8N Commerce","version":"1.0","type":"link"}