Help adjusting the display price for variable products on the WooCommerce store page


I'm not a PHP expert, but I managed to put together this code, which is included in my Themes functions.php file. Here is the code in question:

// Change the location of the variation product price
add_action (& # 39; woocommerce_single_product_summary & # 39 ;, & # 39; custom_wc_template_single_price & # 39 ;, 10);
Function custom_wc_template_single_price () {
global $ product;

// Only variable product
if ($ product-> is_type (& # 39; variable & # 39;)):

// Grand Prize
$ prices = Array ($ product-> get_variation_price (# min #, true), $ product-> get_variation_price (# max & # 39 ;, true));
$ price = $ prices[0] ! == $ prices[1] ? sprintf (__ (starts at% 1 $ s & # 39; woocommerce & # 39;)), wc_price ($ prizes)[0] )): wc_price ($ prices)[0] );
$ price2 = $ prices[0] ! == $ prices[1] ? sprintf (__ (& # 39;% 1 $ s & # 39 ;, & # 39; woocommerce & # 39;)), wc_price ($ prices)[0] )): wc_price ($ prices)[0] );

// sale price
$ prices = Array ($ product-> get_variation_regular_price (# min #, true), $ product-> get_variation_regular_price (# max & # 39 ;, true));
sort ($ prices);
$ saleprice = $ prizes[0] ! == $ prices[1] ? sprintf (__ (& # 39;% 1 $ s & # 39 ;, & # 39; woocommerce & # 39;)), wc_price ($ prices)[0] )): wc_price ($ prices)[0] );

if ($ price! == $ saleprice && $ product-> is_on_sale ()) {
$ price = & # 39; starts at & # 39 ;. $ Sales price $ product-> get_price_suffix (). & # 39; & # 39 ;. $ price2. $ product-> get_price_suffix (). & # 39;& # 39 ;;
}

?>
    
    
    
    
    
    <? php

Echo & # 39;

& # 39 ;. $ Price. & # 39;

& # 39 ;. $ Price. & # 39;
& # 39 ;; endif; }

This code changes the way variable products appear on each product page. Here is an example:
https://pr-infrared.com/product/flir-scout-ls-x-r-thermal-monocular/

It takes the typical variation "range" and changes it to "starts at $ XXXX". If there is a sale, the regular price is crossed out and the selling price displayed next to it. It works perfectly!

The problem is that on the shop page (or the category pages) the price is not displayed in this way. See the example here:
https://pr-infrared.com/product-category/handheld-and-mobile-thermal-imaging/

I would like the price of variable products sold to be displayed the same way as on the product pages. "Starts at $ XXXX" with a line through the original price and the selling price in red next to it … only if the product is of course for sale.

Can someone help me solve that?

I am more than happy to pay for somebody's time when he is ready to help.