diff --git a/admin/class-informatiq-sp-admin.php b/admin/class-informatiq-sp-admin.php index ce31df71..80ed6908 100644 --- a/admin/class-informatiq-sp-admin.php +++ b/admin/class-informatiq-sp-admin.php @@ -902,31 +902,12 @@ class Informatiq_SP_Admin { $suggested_price = $insight['suggested_price'] ?? null; $potential_gain = null; $percent_diff = null; - $should_update = false; - - // Get minimum margin setting. - $min_margin = (float) get_option( 'informatiq_sp_minimum_margin', 10 ); if ( $suggested_price && $local_price_incl_tax ) { $potential_gain = round( $suggested_price - $local_price_incl_tax, 2 ); // Calculate percentage difference. $percent_diff = round( ( ( $suggested_price - $local_price_incl_tax ) / $local_price_incl_tax ) * 100, 1 ); - - // Calculate minimum allowed price (current price - margin%). - $min_allowed_price = $local_price_incl_tax * ( 1 - ( $min_margin / 100 ) ); - - // Only suggest update if: - // 1. Google recommends a different price (more than 0.05 diff) - // 2. Suggested price is above our minimum allowed price - $should_update = abs( $potential_gain ) > 0.05 && $suggested_price >= $min_allowed_price; - - // If suggested is below minimum, cap it. - if ( $suggested_price < $min_allowed_price ) { - $suggested_price = round( $min_allowed_price, 2 ); - $potential_gain = round( $suggested_price - $local_price_incl_tax, 2 ); - $percent_diff = round( ( ( $suggested_price - $local_price_incl_tax ) / $local_price_incl_tax ) * 100, 1 ); - } } $comparison[] = array( @@ -943,7 +924,6 @@ class Informatiq_SP_Admin { 'predicted_clicks_change' => $insight['predicted_clicks_change'] ?? null, 'predicted_conversions_change' => $insight['predicted_conversions_change'] ?? null, 'has_insight' => ! empty( $insight ), - 'should_update' => $should_update, ); } diff --git a/assets/js/admin.js b/assets/js/admin.js index 488aa933..a71e2001 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -338,13 +338,13 @@ var clickStyle = product.predicted_clicks_change > 0 ? 'color:#00a32a;' : (product.predicted_clicks_change < 0 ? 'color:#d63638;' : ''); var convStyle = product.predicted_conversions_change > 0 ? 'color:#00a32a;' : (product.predicted_conversions_change < 0 ? 'color:#d63638;' : ''); - // Checkbox and action button - var checkbox = product.has_insight && product.should_update + // Checkbox and action button - show for all products with insight data + var checkbox = product.has_insight && product.suggested_price ? '' : ''; - var actionBtn = product.has_insight && product.should_update + var actionBtn = product.has_insight && product.suggested_price ? '' - : '-'; + : (product.has_insight ? 'No suggestion' : '-'); html += '