/* 
Theme Name: Hello Elementor Child
Theme URI: https://github.com/elementor/hello-theme-child/
Description: Hello Elementor Child is a child theme of Hello Elementor, created by Elementor team
Author: Elementor Team
Author URI: https://elementor.com/
Template: hello-elementor
Version: 2.0.0
Text Domain: hello-elementor-child
License: GNU General Public License v3 or later.
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Tags: flexible-header, custom-colors, custom-menu, custom-logo, editor-style, featured-images, rtl-language-support, threaded-comments, translation-ready
*/

/* Add your custom styles here */


/* SHOW BOTH PRICES IN LOOP */
add_filter('woocommerce_variable_price_html', 'elementor_variable_loop_price', 10, 2);
add_filter('woocommerce_variable_sale_price_html', 'elementor_variable_loop_price', 10, 2);

function elementor_variable_loop_price($price, $product) {

    if (is_admin()) return $price;

    if ($product->is_type('variable')) {

        $regular_price = $product->get_variation_regular_price('min');
        $sale_price    = $product->get_variation_sale_price('min');

        if ($sale_price && $regular_price > $sale_price) {
            return wc_format_sale_price(
                wc_price($regular_price),
                wc_price($sale_price)
            );
        }
    }

    return $price;
}
