Phone Orders For WooCommerce

Show extra information in the cart

The Phone Orders for WooCommerce plugin lets you display custom product data in the phone order cart. For example, you can show the Cost of Goods for each item using a dedicated plugin like WooCommerce Cost of Goods by SkyVerge or YITH WooCommerce Cost of Goods. This guide explains how to enable this extra column and populate it using a simple PHP filter.

Note: This feature is available in both the free and Pro versions of Phone Orders for WooCommerce.


How the Extra Column Works

The plugin includes a built‑in Cart Items section in its settings. When you enable the extra column, the plugin creates a new column in the phone order cart table. You then provide the content for that column using the wpo_product_extra_col_value filter.

What you need:

  1. Enable the extra column in Phone Orders → Settings → Cart Items.
  2. Add a small PHP snippet to your site (via child theme functions.php or the Code Snippetsplugin).
  3. The snippet returns the custom value you want to display (e.g., the cost of goods for each product).

Enabling the Extra Column

Follow these steps to activate the extra column:

  1. Go to WooCommerce → Phone Orders → Settings in your WordPress admin.
  2. Click the Cart Items tab.
  3. Locate the option to show an extra column.
  4. Tick the checkbox to enable it.
  5. Click Save settings.

After enabling, the extra column appears in the phone order cart. At this stage, the column is empty because you have not yet told the plugin what data to display.


The wpo_product_extra_col_value Filter

The plugin provides a dedicated filter hook: wpo_product_extra_col_value. This filter passes three parameters to your callback:

ParameterTypeDescription
$htmlstringThe current content of the extra column (initially empty).
$productWC_ProductThe product object for the current row.
$cartarrayThe cart item data for the current product.

Your callback must return a string. The plugin then displays that string in the extra column for that product row.

Code Examples for Cost of Goods Plugins

For SkyVerge WooCommerce Cost of Goods

The SkyVerge plugin stores the cost of goods in the product meta key _wc_cog_cost. The following snippet retrieves that value and formats it as a price.

For YITH WooCommerce Cost of Goods

The YITH plugin uses the same meta key _wc_cog_cost. The code is identical.

What the code does:

  • get_post_meta( $product->get_id(), "_wc_cog_cost", true ) retrieves the stored cost of goods for the product.
  • wc_price() formats the number as a WooCommerce price (adds the currency symbol and decimal places).
  • The filter runs for every product row in the phone order cart.

Step‑by‑Step Implementation

Step 1: Choose where to add the code

You have two safe options:

  • Option A (Recommended): Use the free Code Snippets plugin. Install it from Plugins → Add Newby searching for “Code Snippets”.
  • Option B: Add the code to your child theme’s functions.php file. Never add custom code directly to a parent theme.

Step 2: Insert the snippet

  • If using Code Snippets:
  • If editing functions.php:

Step 3: Test the functionality

  1. Ensure the extra column is enabled in Phone Orders → Settings → Cart Items.
  2. Open a phone order and add a product that has a cost of goods value.
  3. The extra column should now display the formatted cost.

Customising for Other Data

You can use the same filter to display any product‑specific information stored in meta fields. For example:

  • Display product weight:
    return $product->get_weight() . ' kg';
  • Display a custom SKU field:
    return get_post_meta( $product->get_id(), '_custom_sku', true );
  • Display stock quantity:
    return $product->get_stock_quantity() . ' in stock';

The $cart parameter gives you access to the cart item data, including quantity, variation attributes, and any custom cart item meta.

Have questions? Please submit a support request. We're always happy to help!

Phone Orders
for WooCommerce
PRO

From $120
Buy
✓ 30-day money-back guarantee