Add Admin Side Option Select Post Category Using ACF Taxonomy Field[ Select Post Id in ACF Field ] (Check Box) (single post specific post Shortcode) [ Post Single Page]



 /* single_post_specific_post Shortcode */
function single_post_specific_post()
{

$product_id = get_field('select_try_now_product');

if(empty($product_id)) return;
    
ob_start();

$product = wc_get_product( $product_id );

$img = $product->get_image();
$product_link = get_permalink($product_id);

$rating_count = $product->get_rating_count();
$review_count = $product->get_review_count();
$average      = $product->get_average_rating();

    ?> 

<div class="single-post-trynow-product-wrapper">
<div class="pro-image">
<a href="<?php echo $product_link; ?>">
<?php echo $img; ?>
</a>
</div>

<div class="pro-right-content">
<div class="pro-star-rating">
<?php if ( $rating_count > 0 ) : ?>
<div class="woocommerce woocommerce-product-rating"> 
<div class="star-rating">
<?php echo wc_get_star_rating_html( $average, $rating_count ) //echo $rating_html; ?>
</div>
</div>
<h4>
(<?php echo $review_count; ?> Bewertungen)
</h4>
<?php endif; ?>  
</div>

<div class="pro-title">
<a href="<?php echo $product_link; ?>">
<h4>
<?php echo $product->get_name(); ?>
</h4>
</a>
</div>

<div class="pro-desc">
<?php echo $product->get_short_description(); ?>
</div>

<div class="pro-price">
<?php echo $product->get_price_html(); ?>

<p>
<?php echo get_field('price_per_liter',$product_id); ?>
</p>
</div>

<div class="pro-add-to-cart">
<a href="<?php echo $product_link; ?>" class="button">
Jetzt ausprobieren
</a>
</div>
</div>
</div>
<?php
    return ob_get_clean();
}
add_shortcode( 'single_post_specific_post' , 'single_post_specific_post' );