<?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;
}

/**
 * Single product page layout, set via Customizer > Theme Settings > Shop
 * Page > Single Product Layout ('shop_single_layout' theme_mod):
 *
 * - 'default'        : original Edify layout -- image and summary side by
 *                       side, tabs/description/reviews/upsells/related
 *                       products full width below.
 * - 'sticky-sidebar'  : image column pinned with `position: sticky` while
 *                       scrolling. Summary column holds the title/price/
 *                       Add to Cart button as usual, and directly below
 *                       that button (still inside the same column -- this
 *                       is NOT a separate widget-area column like the blog
 *                       sidebar) a "Shop Sidebar" widget area is printed,
 *                       for things like a trust badge, shipping note, or
 *                       a small promo widget. It only prints when that
 *                       widget area (Appearance > Widgets > Shop Sidebar)
 *                       actually has widgets in it. Description/Reviews
 *                       tabs, upsells and related products run full width
 *                       below, same as the default layout.
 */
$edify_single_layout   = get_theme_mod( 'shop_single_layout', 'default' );
$edify_use_shop_sidebar = ( 'sticky-sidebar' === $edify_single_layout ) && is_active_sidebar( 'shop-sidebar' );
?>

<div id="product-<?php the_ID(); ?>" <?php wc_product_class( 'row edify-single-product-layout-' . esc_attr( $edify_single_layout ), $product ); ?>>

	<?php if ( 'sticky-sidebar' === $edify_single_layout ) : ?>

		<div class="col-xl-6 col-lg-6">
			<div class="product__details-thumb-tab mr-70 p-relative edify-product-sticky-col">
				<?php do_action( 'woocommerce_before_single_product_summary' ); ?>
			</div>
		</div>
		<div class="col-xl-6 col-lg-6">
			<div class="summary entry-summary product__details-wrapper">
				<?php do_action( 'woocommerce_single_product_summary' ); ?>
			</div>

			<?php if ( $edify_use_shop_sidebar ) : ?>
				<div class="edify-shop-sidebar-inline">
					<?php dynamic_sidebar( 'shop-sidebar' ); ?>
				</div>
			<?php endif; ?>
		</div>

		<?php
		/**
		 * @hooked woocommerce_output_product_data_tabs - 10 (Description / Additional information / Reviews)
		 * @hooked woocommerce_upsell_display - 15
		 * @hooked woocommerce_output_related_products - 20
		 */
		do_action( 'woocommerce_after_single_product_summary' );
		?>

	<?php else : ?>

		<div class="col-xl-7 col-lg-6">
			<div class="product__details-thumb-tab mr-70 p-relative">
				<?php
				/**
				 * Hook: woocommerce_before_single_product_summary.
				 *
				 * @hooked woocommerce_show_product_sale_flash - 10
				 * @hooked woocommerce_show_product_images - 20
				 */
				do_action( 'woocommerce_before_single_product_summary' );
				?>
			</div>
		</div>
		<div class="col-xl-5 col-lg-6">
			<div class="summary entry-summary product__details-wrapper">
				<?php
				/**
				 * Hook: woocommerce_single_product_summary.
				 *
				 * @hooked woocommerce_template_single_title - 5
				 * @hooked woocommerce_template_single_rating - 10
				 * @hooked woocommerce_template_single_price - 10
				 * @hooked woocommerce_template_single_excerpt - 20
				 * @hooked woocommerce_template_single_add_to_cart - 30
				 * @hooked woocommerce_template_single_meta - 40
				 * @hooked woocommerce_template_single_sharing - 50
				 * @hooked WC_Structured_Data::generate_product_data() - 60
				 */
				do_action( 'woocommerce_single_product_summary' );
				?>
			</div>
		</div>

		<?php
		/**
		 * Hook: woocommerce_after_single_product_summary.
		 *
		 * @hooked woocommerce_output_product_data_tabs - 10
		 * @hooked woocommerce_upsell_display - 15
		 * @hooked woocommerce_output_related_products - 20
		 */
		do_action( 'woocommerce_after_single_product_summary' );
		?>

	<?php endif; ?>

</div>

<?php do_action( 'woocommerce_after_single_product' ); ?>
