How to Add the Cost of Goods in WooCommerce

cost-of-goods-in-WooCommerce

When running an online store with WooCommerce, it’s essential to accurately calculate the cost of goods sold to maintain profitability and make informed business decisions. WooCommerce, by default, doesn’t provide a built-in feature to add the cost of goods. However, there are plugins available that can seamlessly integrate with WooCommerce and provide the necessary functionality. 

In this article, we will explore methods for adding the cost of goods sold in WooCommerce.

Add Cost of Goods Sold in WooCommerce

There are two methods that can be implemented to add the cost of goods sold in WooCommerce. These include:

  1. WooCommerce Cost of Goods Sold by Addify
  2. Add Cost of Goods Sold in WooCommerce Programmatically

Let’s discuss both of these methods in detail. 

Method # 1: WooCommerce Cost of Goods Sold by Addify

WooCommerce Cost of Goods Sold is a valuable plugin for merchants using the WooCommerce platform. By integrating this plugin, merchants gain the ability to input and track the cost of their products, enabling them to generate comprehensive revenue and stock reports. This extension proves especially useful in maintaining accurate records of real profit margins.

Installation

  1. Download the .zip file from your WooCommerce account.
  2. Go to WP Admin > Plugins > Add New and Upload Plugin. Upload the file you have downloaded.
  3. Next, click on Install Now and Activate.

Setup and Configuration

After activating the WooCommerce Cost of Goods Sold plugin, go to WooCommerce > Cost of Goods. Click to view and configure settings suited to your store requirements. 

Configure Cost Settings for Orders

WooCommerce Cost of Goods Sold provides a range of customizable options through its general settings tab, allowing merchants to tailor the plugin to their specific needs. These options include:

  • Calculate and display profit margins for all orders, including existing orders
  • Specify the number of items displayed per page in both stock and sales reports
  • Customize reports columns:
    • Choose to display the product tag column
    • Choose to display the percentage margin column
  • Specify order statuses for sales reports
  • Choose to enable columns in the default order table:
    • Total cost column
    • Profit column
    • Currency symbol
blank

Adding Cost of Products

There are three ways to add product cost. These include:

  1. Product Edit Sheet
  2. CSV Import
  3. Global Rules

Adding Cost from Product Edit Sheet

You can edit any existing product to add its cost. Go to WP Admin > Products

  • Edit the Product: You can edit any product by selecting the product you want to edit.
  • Add Cost for Simple Products: If the product is a simple product (not a variable product with variations), scroll down to the Product Data > General. You will find a Cost of Goods field. Enter the cost of the product in this field.
  • Add Cost for Variable Products: If the product is a variable product with variations, scroll down to the Product Data > Variations. Expand each variation, and you will find a Cost field for each variation. Enter the cost for each variation individually.
  • Lock the Cost: By default, the cost you enter on the product page will be subject to global rules and CSV import updates. However, if you want to lock the cost and prevent it from being updated through global rules and CSV imports, you can select the ‘Lock Cost of Goods’ checkbox. This ensures that the cost will only be updated manually from the product data screen.
  • Save the Changes: Once you have entered the cost or locked it, click the ‘Update’ or ‘Publish’ button to save the changes to the product.
blank

Adding Cost Using CSV Import

Go to WooCommerce > Cost of Goods > Import to add costs to multiple products using CSV import.

Download the CSV File Format: Download the pre-defined CSV file format. Click on the download link to obtain the CSV template.

Prepare the CSV File

Import the CSV File: Click the “Choose File” button and select the CSV file you prepared to start the import process.

Access Updated Costs for Products 

Note: File format should be [Product ID | Product Name | Cost of Goods].

blank

Adding Cost Using Global Rules

To add costs in bulk to selected products and categories using global rules in the WooCommerce Cost of Goods plugin, follow these steps:

Access Global Rules: Navigate to WooCommerce > Cost of Goods > Rules. 

Define Rule Criteria: Choose to apply the rule to specific products, categories, or a combination of both. 

Specify Cost Calculation Method: Choose from two options:

  • Fixed 
  • Percentage 

Set Cost Values: Enter the specific cost value if you chose a fixed amount. If you opted for a percentage, specify the percentage that will be used to calculate the cost.

Save the Settings

blank

Access Reports

Sales and Profit Reports

The plugin provides merchants with a comprehensive overview of their per-product and aggregate profit margins over a selected time period. 

These reports offer valuable insights into the financial performance of products and categories, allowing merchants to make informed decisions about their business strategies.

Stock and Potential Profit Reports

This report gives merchants valuable insights into their current stock value and potential profit. 

blank

View Profits on Orders Grid

The WooCommerce Cost of Goods Sold plugin enhances the default order detail page by adding two new columns: total cost and profit. These columns provide valuable information about the cost of goods and the resulting profit for each order. This feature lets merchants easily view and analyze their profit margins directly from the order grid.

blank

Method # 2: Add the Cost of Goods Sold in WooCommerce Programmatically

The second method to add the cost of goods sold in your WooCommerce is through a program-based implementation.

add_action( 'woocommerce_product_options_general_product_data', array( $this, 'af_cog_custom_fields_in_general' ) ); 

add_action( 'woocommerce_variation_options_pricing', array( $this ,'af_cog_to_variations' ) , 10, 3 );

public function af_cog_custom_fields_in_general() {

global $woocommerce, $post;

woocommerce_wp_text_input(

array(

'id'          => 'af_cog_cos_of_product',

'label'       => __( 'Cost Of Goods', 'woocommerce' ),

'placeholder' => 'Enter Cost of Goods',

'type'   => 'number',

'value' => get_post_meta($post->ID, 'af_cog_cos_of_product', true),

'custom_attributes' => array(

'step' => 'any',

'min' => '0'

),

)

);

    }

public function af_cog_to_variations( $loop, $variation_data, $variation ) {

woocommerce_wp_text_input( array(

'id' => 'af_cog_cos_of_product[' . $variation->ID . ']',

'class' => 'short',

'label' => __( 'Cost Of Goods', 'woocommerce' ),

'type'  => 'number',

'custom_attributes' => array(

'step' => 'any',

'min' => '0'

),

'value' => get_post_meta( $variation->ID, 'af_cog_cos_of_product', true ),

)

);

}

Final Thoughts 

Adding the cost of goods in WooCommerce is a crucial step for any business looking to accurately track and manage its inventory and profit margins. By implementing this feature, WooCommerce provides merchants with a comprehensive solution to monitor their product costs, calculate profits, and make informed business decisions. 

If you have any additional questions or need further assistance, please don’t hesitate to reach out to our dedicated support team. They are always available to provide guidance and address any concerns you may have. 

blank

Kim Parsons

Kim Parsons is outreach specialist and technical writer at Addify. When it comes to writing his main areas of interest are web and ecommerce development. Apart from writing his interests include watching Netflix and playing baseball in his backyard.

Join our newsletter


    Subscribe to Our Newsletters.

    Be the first to get an exclusive offer and the latest news.