Hey @aming4stars,
sorry for the late response. This is what I ended up with. I’m using the tier price option for the different prices, btw.
To output the different prices, I created a shortcode:
function display_hp_price_tiers() {
global $post;
if ($post && $post->post_type === 'hp_listing') {
$price_tiers = get_post_meta($post->ID, 'hp_price_tiers', true);
$price_tiers = maybe_unserialize($price_tiers);
if (!empty($price_tiers) && is_array($price_tiers)) {
$output = '<div class="hp-listing__attributes hp-listing__attributes--primary hp-block preisliste">';
$output .= '<div class="package-prices">';
foreach ($price_tiers as $tier) {
if (isset($tier['name'], $tier['price'])) {
$translations = [
'Daily rental' => __('Daily rental', 'textdomain'),
'Weekend rental' => __('Weekend rental', 'textdomain'),
'Weekly rental' => __('Weekly rental', 'textdomain'),
'Monthly rental' => __('Monthly rental', 'textdomain')
];
$translated_name = isset($translations[$tier['name']]) ? $translations[$tier['name']] : $tier['name'];
$output .= '<div class="price-option" data-price="' . esc_attr($tier['price']) . '">';
$description = !empty($tier['description']) ? esc_html($tier['description']) : '0';
$output .= '<div class="package-name" data-name="'. esc_html($tier['name']) .'">'. esc_html($translated_name) . '</div>';
$output .= '<div class="package-price">' . esc_html($tier['price']) . ' €</div><div class="package-detail">'. __('incl.', 'textdomain') . ' ' .$description . ' KM</div>';
$output .= '</div>';
}
}
$output .= '</div></div>';
return $output;
}
}
return 'No prices available.';
}
add_shortcode('package_prices', 'display_hp_price_tiers');
To output the prices, I’ve created a hivepress Template for listings and use the shortcode [package_prices] to get this:
The whole code for chaning the prices (sorry I used no comments):
add_action('init', function() {
if (!session_id()) {
session_start();
}
});
add_action('wp_footer', function() {
if (is_singular('hp_listing')) {
?>
<script>
jQuery(document).ready(function($) {
$('.price-option').on('click', function() {
var packageName = $(this).find('.package-name').data('name');
var listingId = '<?php echo get_the_ID(); ?>';
if (!packageName) {
return;
}
localStorage.setItem('selected_listing_package_' + listingId, packageName);
$('.price-option').removeClass('selected');
$(this).addClass('selected');
$.ajax({
url: '<?php echo admin_url('admin-ajax.php'); ?>',
type: 'POST',
data: {
action: 'save_selected_package',
listing_id: listingId,
package_name: packageName
},
success: function(response) {
if (response.success) {
$('.hp-form--booking-make .hp-field--date-range .flatpickr-input').trigger('change');
$('.hp-form--booking-make').addClass('notdisabled');
}
}
});
});
});
</script>
<?php
}
});
add_action('wp_ajax_save_selected_package', 'save_selected_package');
add_action('wp_ajax_nopriv_save_selected_package', 'save_selected_package');
function save_selected_package() {
if (!isset($_POST['listing_id']) || !isset($_POST['package_name'])) {
wp_send_json_error(['message' => 'Fehlende Parameter']);
wp_die();
}
$listing_id = intval($_POST['listing_id']);
$package_name = sanitize_text_field($_POST['package_name']);
// Paketname in der Session speichern
$_SESSION['selected_package_' . $listing_id] = $package_name;
wp_send_json_success(['package_name' => $package_name]);
wp_die();
}
add_filter('hivepress/v1/models/listing/cart', function ($cart, $listing) {
if (!$listing) {
return $cart;
}
$listing_id = $listing->get_id();
$selected_package = $_SESSION['selected_package_' . $listing_id] ?? '';
if (empty($selected_package)) {
return $cart;
}
$tiers = get_post_meta($listing_id, 'hp_price_tiers', true);
if (!$tiers || !is_array($tiers)) {
return $cart;
}
$selected_price = null;
foreach ($tiers as $tier) {
if ($tier['name'] === $selected_package) {
$selected_price = $tier['price'];
break;
}
}
if (!$selected_price) {
return $cart;
}
$cart['meta']['price'] = floatval($selected_price);
$cart['args']['_quantity'] = 1; // Menge immer 1 setzen
$_SESSION['selected_package_price'] = floatval($selected_price);
return $cart;
}, 1000, 2);
add_action('woocommerce_before_calculate_totals', function($cart) {
if (is_admin() && !defined('DOING_AJAX')) return;
foreach ($cart->get_cart() as $cart_item) {
if (isset($cart_item['data'])) {
$product = $cart_item['data'];
$custom_price = $_SESSION['selected_package_price'] ?? null;
if (!$custom_price) {
continue;
}
$cart_item['data']->set_price($custom_price);
}
}
});
I’m sure there are better solutions for this, but for me, this was a big deal and it seems to work just as I need it to! 
I really hope this helps you.
Cheers, Viktor