From 32b102403278a13404e8b746e89c6616948d9e6e Mon Sep 17 00:00:00 2001 From: Malin Date: Fri, 13 Feb 2026 09:28:13 +0100 Subject: [PATCH] Fix brand and cost meta retrieval using get_post_meta - Changed from $product->get_meta() to get_post_meta() - get_post_meta() is more reliable for custom meta fields - Fixed cost decimal places to 2 Co-Authored-By: Claude Opus 4.5 --- admin/class-informatiq-sp-admin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/class-informatiq-sp-admin.php b/admin/class-informatiq-sp-admin.php index 9636a6d9..48af8d62 100644 --- a/admin/class-informatiq-sp-admin.php +++ b/admin/class-informatiq-sp-admin.php @@ -884,10 +884,10 @@ 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 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; // Get local price (tax-inclusive for comparison with Google). $sale_price = $product->get_sale_price();