Add VAT to cost for consistent tax-inclusive display

All prices now shown with VAT included:
- Cost: converted using wc_get_price_including_tax()
- Your Price: already tax-inclusive
- Suggested: from Google, always tax-inclusive

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-16 11:23:23 +01:00
parent 32b1024032
commit 48439e3bad

View File

@@ -886,8 +886,14 @@ class Informatiq_SP_Admin {
// Get brand and cost from post meta.
$brand = get_post_meta( $product_id, '_brand', true );
$cost = get_post_meta( $product_id, '_cost', true );
$cost = ( $cost !== '' && $cost !== false ) ? round( (float) $cost, 2 ) : null;
$cost_raw = get_post_meta( $product_id, '_cost', true );
// Convert cost to tax-inclusive to match other prices.
$cost = null;
if ( $cost_raw !== '' && $cost_raw !== false ) {
$cost = wc_get_price_including_tax( $product, array( 'price' => (float) $cost_raw ) );
$cost = round( $cost, 2 );
}
// Get local price (tax-inclusive for comparison with Google).
$sale_price = $product->get_sale_price();