---
title: Product Cost and Profit Shortcodes Reference
description: "Reference for the WooCommerce product cost and profit shortcodes: attributes, profit placeholders and examples."
url: "https://wpfactory.com/docs/unlocking-real-profits-with-product-shortcodes/"
updated: "2026-09-27"
category: Shortcodes
tags:
  - Cost of Goods
---

# Product Cost and Profit Shortcodes Reference

The product cost and profit shortcodes let you display a product's cost or profit anywhere on your WooCommerce store. [Cost of Goods: Product Cost & Profit Calculator for WooCommerce](https://wpfactory.com/item/cost-of-goods-for-woocommerce/) ships two shortcodes for this, and both are free. This is the full reference for their tags, attributes and defaults.

![Shortcodes sub-tab showing [wpfcogs_product_profit] and [wpfcogs_product_cost] enable checkboxes](https://wpfactory.com/wp-content/uploads/unlocking-real-profits-with-product-shortcodes-1.png)

### The two shortcodes

- `[wpfcogs_product_cost]`: shows a product's cost. Useful in admin views or gated wholesale sections where cost transparency is wanted.
- `[wpfcogs_product_profit]`: shows a product's profit (price minus cost).

**Enable them first.** Both are off by default. Turn them on under **WPFactory > Cost of Goods > Shortcodes** (also reachable at **WooCommerce > Settings > Cost of Goods > Shortcodes**) before using them, or they output nothing.

### Attributes

| Attribute | Applies to | Default | Purpose |
| --- | --- | --- | --- |
| `product_id` | Both | Current product | The product to read. If empty, the current product is used. |
| `html_template` | Both | `<span class="wpfcogs-product-cost">{content}</span>` / `...-product-profit...` | Wrapper HTML. `{content}` is replaced with the value. |
| `profit_template` | `[wpfcogs_product_profit]` | `%profit% (%profit_percent%)` | The value format. Placeholders below. |

### Profit placeholders

- `%profit%`: the profit amount.
- `%profit_percent%`: profit divided by cost, as a percentage.
- `%profit_margin%`: profit divided by price, as a percentage.

### Examples

```
[wpfcogs_product_cost]
[wpfcogs_product_profit product_id="123"]
[wpfcogs_product_profit profit_template="%profit% (%profit_margin% margin)"]
```

### Note on the old tags

The previous names `[alg_wc_cog_product_cost]` and `[alg_wc_cog_product_profit]` were renamed in v4.1.6. They still resolve but now emit a deprecation notice, so use the `wpfcogs_` tags in new work.

### See also

For a step-by-step walkthrough, see [Show product cost and profit with shortcodes](https://wpfactory.com/docs/cost-of-goods-for-woocommerce/).

### Get more from Cost of Goods

These shortcodes are free. [Cost of Goods: Product Cost & Profit Calculator for WooCommerce](https://wpfactory.com/item/cost-of-goods-for-woocommerce/) Pro adds cost and profit across WooCommerce Analytics, order emails and multicurrency stores. [See what Pro unlocks](https://wpfactory.com/item/cost-of-goods-for-woocommerce/).

Related articles

- [Show Product Cost and Profit with Shortcodes](https://wpfactory.com/docs/product-shortcodes-cost/)
- [Cost and Profit Missing on Orders From POS, API or Other Plugins](https://wpfactory.com/docs/cost-of-goods-missing-on-pos-api-orders/)
- [Track Product Cost History with the Cost Archive](https://wpfactory.com/docs/product-cost-history-archive/)
- [Import Product Costs From Another Meta Key](https://wpfactory.com/docs/import-product-costs-from-meta/)
- [Import and Export Product Costs via CSV](https://wpfactory.com/docs/import-export-product-costs-csv/)

 

[![Cost of Goods Sold (COGS): Cost & Profit Calculator for WooCommerce](https://wpfactory.com/wp-content/uploads/Cost-of-Goods-for-WooCommerce.webp)](https://wpfactory.com/item/cost-of-goods-for-woocommerce/)
