Question

What is the suggested method for tracking COGS for products within Magento? We have recently learned that it will be necessary to track the inbound cost of each item that is sold in the store and it seems that this might be something that would be provided by Magento out of the box, however I'm not seeing this option.

One option I've seen is to perhaps follow the method outlined here: "How do i show Manufacturer’s Suggested Retail Price?," however I'm just not convinced that this is the right vector of attack.

Was it helpful?

Solution

Cost of goods sold (COGS) refer to the inventory costs of those goods a business has sold during a particular period.

So let's get the obvious out of the way: Magento has a cost attribute already set up:

enter image description here

But in reality this isn't going to do us any good at all unless we are using Average Cost as our calculation method (and we assume that the price of these goods will never change, which they will, but in this example they won't ... even though they will).

If that is the case, we define our average cost method:

Average cost. The average cost method relies on average unit cost to calculate cost of units sold and ending inventory.

OK, so something happens where we determine that, on average, a product costs a specific amount to the company. Store that in the cost attribute. Then we calculate COGS:

Per Sales over Lifetime on a Single SKU:

/* Get only sales items with sku of SKU001 that are parents or simples */
$collection = Mage::getResourceModel('sales/order_item')
                 ->addFieldToFilter('sku',array('eq'=>'SKU001'))
                 ->addFieldToFilter('parent_item_id',array('null'=>true));

$COGS = 0.00;
foreach($collection as $_item){
    $COGS += $_item->getProduct()->getCost()
}
return $COGS;

Well that wasn't too difficult for average cost, although it's not any good for a 'report'. As homework you could create a custom collection with columns that have Zend_Db_Expr to get a columnar view of all SKUs and their associated costs.

Let's look at the other methods:

  • LIFO
  • FIFO
  • Specific Identification

LIFO

The newest items in inventory are sold off first. This would make for inventory tracking challenges in Magento since Lots and costs are not tracked. Lot number needs to be tracked at the time of purchase and a record of Lots v. Costs would have to be consulted in order to generate the report using the appropriate calculation method.

FIFO

Oldest items in inventory are used to fulfill current orders. Same challenges or implementation methods realized with inventory management as LIFO.

Specific Identification

Every product is added to the catalog with its own SKU and cost data. Cumbersome. Custom dev required to merchandise a canonical version of the product. Don't do this in Magento - it sounds awful; find an ERP integration that has an inventory and P&L / reporting modules.

Wrap-up:

Calculating based on Average is fairly simple.

Other calculation methods require work and development. In general, a product belonging to a Lot needs to have its own SKU and cost data saved to the database. Custom reporting required - nothing built-in.

Best of luck.

Source: http://en.wikipedia.org/wiki/Cost_of_goods_sold

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top