Support #12258
openSupport #12257: Vendor Management flow Issues
Retail Selling Price Gets Overwritten by Wholesale Cost (Pricing Corruption)
0%
Description
Code Location: vendorInvoiceController.js:L287
What is happening in code: When a new vendor invoice is saved, the code intends to update the wholesale purchase cost. But instead of updating purchasePrice, it updates variants.$[v].price—which is the customer-facing retail selling price!
Real-Life Example:
You sell a Silk Printed Shirt (Size L) in your store and on your website for $60.00.
A vendor invoice arrives for a new shipment where your wholesale cost is $18.00 / shirt.
You enter this invoice into the system.
What breaks immediately: The retail selling price on both the POS register and the E-Commerce website changes from $60.00 down to $18.00!
Business Impact: Customers buy your $60 shirts for $18 at cost price. The business loses $42 on every sale until someone notices.
Simple Fix :
// Change this line (L287):
variantUpdateQuery.$set = { "variants.$[v].price": unitCost };
// To this:
variantUpdateQuery.$set = { "variants.$[v].purchasePrice": unitCost };
Subtasks
Related issues