Project

General

Profile

Edit Copy Actions

Support #12258

open

Support #12257: Vendor Management flow Issues

Retail Selling Price Gets Overwritten by Wholesale Cost (Pricing Corruption)

Added by Yalavarthi Thriveni 9 days ago. Updated 9 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
11/20/2026
Due date:
% Done:

0%

Estimated time:

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 };


Add

Subtasks


Add

Related issues

Edit Copy Actions

Also available in: Atom PDF