@@ -183,11 +183,11 @@ public function prodcut_list() {
183183 );
184184
185185 $ _product = wc_get_product ( $ product ->ID );
186- $ sale_price = $ _product ->get_sale_price ();
186+ $ current_price = $ _product ->get_price ();
187187 $ regular_price = $ _product ->get_regular_price ();
188188
189189 // Prepare woocommerce price data.
190- $ price = esc_html ( $ regular_price );
190+ $ price = esc_html ( $ current_price );
191191 $ price = wp_strip_all_tags ( html_entity_decode ( wc_price ( $ price ) ) );
192192
193193 // Render woocommerce price with currency symbol.
@@ -206,7 +206,7 @@ public function prodcut_list() {
206206 // Get categories csv.
207207 $ category_names = implode ( ', ' , $ category_names );
208208
209- if ( $ _product ->is_type ( 'simple ' ) && $ regular_price ) {
209+ if ( $ _product ->is_type ( 'simple ' ) && $ current_price ) {
210210 $ simple_product_for_offer [] = array (
211211 'price ' => $ price ,
212212 'value ' => $ product ->ID ,
@@ -262,20 +262,17 @@ public function prodcut_list_for_view() {
262262 // Use get_price() method directly since it gives the current price
263263 $ current_price = $ _product ->get_price ();
264264 $ regular_price = $ _product ->get_regular_price ();
265- $ sale_price = $ _product ->get_sale_price ();
266265
267266 // Ensure we have valid numeric values for number_format
268267 $ current_price = is_numeric ( $ current_price ) ? (float ) $ current_price : 0.00 ;
269268 $ regular_price = is_numeric ( $ regular_price ) ? (float ) $ regular_price : $ current_price ;
270- $ sale_price = is_numeric ( $ sale_price ) ? (float ) $ sale_price : null ;
271269
272270 $ product_list_for_view [ $ product ->ID ] = array (
273271 'ID ' => $ product ->ID ,
274272 'post_title ' => $ _product ->get_title (),
275273 'image_url ' => wp_get_attachment_url ( get_post_thumbnail_id ( $ product ->ID ), 'thumbnail ' ),
276274 'regular_price ' => number_format ( $ regular_price , 2 ),
277275 'current_price ' => number_format ( $ current_price , 2 ),
278- 'sale_price ' => $ sale_price ? number_format ( $ sale_price , 2 ) : null ,
279276 );
280277 }
281278 if ( $ _product ->is_type ( 'variable ' ) ) {
@@ -293,12 +290,10 @@ public function prodcut_list_for_view() {
293290
294291 $ current_variation_price = $ variation_product ->get_price ();
295292 $ variation_regular_price = $ variation_product ->get_regular_price ();
296- $ variation_sale_price = $ variation_product ->get_sale_price ();
297293
298294 // Ensure we have valid numeric values for number_format
299295 $ current_variation_price = is_numeric ( $ current_variation_price ) ? (float ) $ current_variation_price : 0.00 ;
300296 $ variation_regular_price = is_numeric ( $ variation_regular_price ) ? (float ) $ variation_regular_price : $ current_variation_price ;
301- $ variation_sale_price = is_numeric ( $ variation_sale_price ) ? (float ) $ variation_sale_price : null ;
302297
303298 $ formatted_price = number_format ( $ current_variation_price , 2 );
304299 $ variation_root_name = $ _product ->get_title ();
@@ -311,7 +306,6 @@ public function prodcut_list_for_view() {
311306 'image_url ' => $ image_url ,
312307 'regular_price ' => number_format ( $ variation_regular_price , 2 ),
313308 'current_price ' => $ formatted_price ,
314- 'sale_price ' => $ variation_sale_price ? number_format ( $ variation_sale_price , 2 ) : null ,
315309 );
316310 }
317311 }
0 commit comments