<?php
/**
 * The template for displaying product content in the single-product.php template
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/content-single-product.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see     https://docs.woocommerce.com/document/template-structure/
 * @package WooCommerce\Templates
 * @version 3.6.0
 */

defined( 'ABSPATH' ) || exit;

global $product;

/**
 * Hook: woocommerce_before_single_product.
 *
 * @hooked woocommerce_output_all_notices - 10
 */
do_action( 'woocommerce_before_single_product' );

if ( post_password_required() ) {
	echo get_the_password_form(); // WPCS: XSS ok.
	return;
}

$product_id = get_the_ID();



$shop_meta = get_post_meta($post->ID, 'glowify_wp_shop_options', true) ?: [];

$shop_layout = $shop_meta['shop_layout'] ?? 'style-1'; 

$enable_voucher = $shop_meta['enable_voucher'] ?? false;
$voucher_heading = $shop_meta['voucher_heading'] ?? '';       
$voucher_desc = $shop_meta['voucher_desc'] ?? '';      
$voucher_list = $shop_meta['voucher_list'] ?? [];  
$product_features = $shop_meta['product_features'] ?? [];
$product_use = $shop_meta['product_use'] ?? [];

// Get the first product category
$terms = get_the_terms( $product->get_id(), 'product_cat' );
$category_name = !empty($terms) ? $terms[0]->name : '';

// Get rating
$average_rating = $product->get_average_rating();
$review_count   = $product->get_review_count();

// Get total sales
$total_sales = $product->get_total_sales();
$total_sales_display = $total_sales >= 1000 ? round($total_sales / 1000, 1) . 'K' : $total_sales;


?>
<div id="product-<?php the_ID(); ?>" <?php wc_product_class( '', $product ); ?>>


<?php get_template_part( 'woocommerce/theme-part/product-detail-layout' ); ?>

	
</div>
