Add Brand and Cost columns to price comparison table

- Brand column (from _brand meta) before SKU
- Cost column (from _cost meta) before Your Price
- Helps evaluate suggested prices against actual product cost

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 08:02:05 +01:00
parent eaff86aad1
commit 0683f794dc
2 changed files with 14 additions and 1 deletions

View File

@@ -620,8 +620,10 @@ class Informatiq_SP_Admin {
<thead>
<tr>
<th style="width: 30px;"><input type="checkbox" id="informatiq-sp-select-all-header"></th>
<th><?php esc_html_e( 'Brand', 'informatiq-smart-pricing' ); ?></th>
<th><?php esc_html_e( 'SKU', 'informatiq-smart-pricing' ); ?></th>
<th><?php esc_html_e( 'Product', 'informatiq-smart-pricing' ); ?></th>
<th><?php esc_html_e( 'Cost', 'informatiq-smart-pricing' ); ?></th>
<th><?php esc_html_e( 'Your Price', 'informatiq-smart-pricing' ); ?></th>
<th><?php esc_html_e( 'Suggested', 'informatiq-smart-pricing' ); ?></th>
<th title="<?php esc_attr_e( 'Percentage difference from your price', 'informatiq-smart-pricing' ); ?>">
@@ -882,6 +884,11 @@ class Informatiq_SP_Admin {
$product_id = $product->get_id();
// Get brand and cost from meta.
$brand = $product->get_meta( '_brand', true );
$cost = $product->get_meta( '_cost', true );
$cost = $cost !== '' ? round( (float) $cost, 4 ) : null;
// Get local price (tax-inclusive for comparison with Google).
$sale_price = $product->get_sale_price();
$regular_price = $product->get_regular_price();
@@ -913,8 +920,10 @@ class Informatiq_SP_Admin {
$comparison[] = array(
'id' => $product_id,
'brand' => $brand ?: '',
'name' => $product->get_name(),
'sku' => $sku,
'cost' => $cost,
'local_price' => $local_price_incl_tax ? round( $local_price_incl_tax, 2 ) : null,
'price_type' => $price_type,
'google_price' => $insight['google_price'] ?? null,