BEAR - WooCommerce Bulk Editor and Products Manager Professional

WooCommerce bulk edit cost of goods and purchase price

To bulk edit cost of goods in WooCommerce, the first question is not how but where: the cost of a product is not a standard column of the product list, and depending on the plugin that records it, it lives in a different meta key or in a table of its own. Once you know the key, BEAR edits it like a price: set it for hundreds of products at once, raise it by a percentage when a supplier changes prices, or calculate it as a share of the regular price. Below is where each source keeps the cost, how to attach it, the formula for cost from the regular price, and what cannot be edited this way.

Where WooCommerce keeps the product cost

Source of the costWhere it is storedBulk editable in BEAR
WooCommerce Cost of Goods Sold (built in)Meta key _cogs_total_value on products and variationsYes, as a number meta field
The WooCommerce Cost of Goods extensionMeta key _wc_cog_costYes, as a number meta field
Other cost or purchase price plugins, custom fieldsUsually a meta key of their ownYes, if it is post meta
ATUM purchase price and supplier dataATUM's own database table, not post metaNo

WooCommerce's own field is switched on under WooCommerce → Settings → Advanced → Features → Cost of Goods Sold. A Cost of goods field then appears in the General tab of the product editor and on each variation. A variation without its own cost uses the cost of its parent product, so a variable product can carry one default cost for all its variations and override it where a variation costs more. WooCommerce stores the cost with each order when its totals are calculated, normally at checkout, so changing costs later affects new orders rather than past ones.

For any other plugin, find the key instead of guessing it. In BEAR's Meta Fields tab, Get meta keys from any product by its ID loads every meta key of a product: enter the ID of a product whose cost is filled in and look for the key that holds that number. The Meta Fields documentation shows both ways of adding keys.

Add the cost field as a column

  1. In the Meta Fields tab use Add Custom key by hands with _cogs_total_value (or your plugin's key), or pick the key from Get meta keys from any product by its ID.
  2. Give it a short title such as Cost, choose the type number and the view textinput, and press Save meta fields.
  3. In the Settings tab switch the new Cost column on and save. This step is required: a meta field appears in the Filters and Bulk Edit tabs only while its column is switched on.

The column now shows the cost of every product, it can be edited cell by cell, sorted, and filtered by a from/to range. Entering 0 in both boxes of its filter lists the products with no cost yet; more checks of that kind are in finding products with missing data.

Bulk edit cost of goods for many products

Filter the products, for example by supplier tag or category, check the line Bulk editing will be applied to at the top of the Bulk Edit tab, and use the Cost row in the numeric section:

  • set new gives every selected product the same cost.
  • increase by % and decrease by % follow a supplier's price change: 8 with increase by % raises every cost by 8%.
  • increase by value and decrease by value add or subtract a fixed amount, for example a new shipping surcharge per unit.

For variable products, switch on variations on the tools panel so that the run writes the cost of each variation. Alternatively write one cost on the parent products with the switch off, and let the variations without a cost of their own inherit it.

Cost as a percentage of the regular price

When you know your margin rather than every purchase price, calculate the cost from the price. Below the numeric rows is a block called Selected num fields: an operator (+, -, *, /) and a list of numeric fields. After the row's own operation, BEAR applies that operator with the chosen field of the same product. For cost = 30% of the regular price:

  1. Filter the products and filter out those without a price: regular price from 0.01.
  2. Tick only the Cost row, choose set new and enter 0.3.
  3. In Selected num fields choose * and regular price.
  4. Press Do Bulk Edit. A product priced 100 gets a cost of 30.

Two rules keep the result clean. The formula is applied to every numeric row that is ticked, so tick nothing else in the same run. And run variable products with the variations switch on: parent products have no regular price of their own, so without the switch they would get a cost of 0, which their variations would then inherit. A margin of 70% means a cost of 30% of the price; the factor is 1 - margin.

The same block copies a cost from one field to another, which is how you move from a plugin to WooCommerce's own field. Attach both keys as number meta fields, filter by the old field from 0.01 so that products without a cost are left out, tick the new Cost row with set new and 0, and choose + with the old field: each product gets 0 plus its old cost.

Rounding the cost to cents

Percentages produce long fractions. The rounding drop-down under the numeric rows rounds to whole numbers, up to 0.05 or 0.10, or to price endings such as .99, as described in price rounding; it has no "two decimals" option. To round the cost to cents, leave the drop-down at no rounding and add this filter, which receives the value after the formula:

/*
 * BEAR: round the cost to whole cents when a bulk edit or a cell edit writes it.
 * Child theme functions.php or a code snippets plugin.
 * Use the meta key of your cost field.
 */
add_filter('woobe_number_field_manipulation', function ($value, $field_key, $product_id) {
    if ('_cogs_total_value' === $field_key && is_numeric($value)) {
        return round((float) $value, 2);
    }
    return $value;
}, 10, 3);

WooCommerce's own CSV export and import also include a Cost of goods column when the feature is on, which suits costs that come from a supplier's spreadsheet. Changes made with BEAR are recorded in the History tab and can be rolled back run by run; a CSV import cannot.

What cannot be edited this way

BEAR's Meta Fields work with data stored as product meta. ATUM keeps its purchase price, supplier and supplier SKU in its own table, so Get meta keys from any product by its ID does not list them and no meta key reaches them; edit them with ATUM's own screens. The same applies to any plugin that stores product data in a custom table.

From cost to margin

BEAR has no built-in margin column, because a margin depends on the price at the time of the sale. Two ways to get one:

  • A stored margin field. Attach a number meta field such as _margin. Run 1: tick it, set new 0, Selected num fields + regular price. Run 2: tick it, increase by value 0, - Cost. The field then holds price minus cost per unit, and sorting its column puts the weakest products first. It is a snapshot: run both steps again after price or cost changes.
  • A margin report from real sales. With the MCP server connected, an AI assistant can report the margin per product for a period: revenue minus WooCommerce's Cost of Goods Sold, worst margin first, with a count of the products that have no cost recorded. It reads WooCommerce's own cost field, and for variations the cost saved on the variation itself, so set costs on variations when you want them in that report.

Before the first run

  • The cost key is known and attached as a number meta field, and its column is switched on.
  • Only the Cost row is ticked when Selected num fields is used.
  • Variable products run with variations on, or the parent cost is set on purpose.
  • Products without a regular price are filtered out before a formula run.
  • A test run on two or three products looks right in the product editor.

If your cost plugin stores its value somewhere you cannot find, post the plugin name and a product ID on the BEAR support forum.