<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

?>

<div class="d-flex flex-wrap">
	<?php
	$min_price           = $attributes['price-range']['min_price'] ?? null;
	$max_price           = $attributes['price-range']['max_price'] ?? null;
	$current_price       = $attributes['price'] ?? null;
	$is_sale_price       = isset( $attributes['sale-price'] ) && ! empty( $attributes['sale-price'] );
	$sale_price          = $attributes['sale-price'] ?? null;
	$display_price_range = $attributes['display-price-range'] ?? true;


	if ( isset( $attributes['display-price-range'] ) && ( $min_price !== $max_price ) ) {
		display_price_range( $min_price, $max_price, $display_price_range );
	} elseif ( $is_sale_price ) {
		if ( $sale_price !== $current_price ) {
			display_single_price( $current_price, true, $sale_price );
		}
	} elseif ( isset( $attributes['tiered-price'], $min_price, $max_price ) ) {
		if ( $min_price === $max_price ) {
			display_single_price( $min_price );
		} else {
			display_price_range( $min_price, $max_price, $display_price_range );
		}
	} elseif ( isset( $min_price ) ) {
		display_single_price( $current_price, false, $sale_price );
	} elseif ( $min_price === $max_price && $min_price !== null ) {
		display_single_price( $current_price, false, $sale_price );
	} else {
		display_single_price( $min_price );
	}
	?>
</div>