<?php

if (! defined('ABSPATH')) {
    exit;
} require_once PUFFERGO_PLUGIN_DIR . '/templates/data/class-puffergo-woo-product-data.php';
$data = PufferGo_Woo_Product_Data::from_current_product();
PufferGo_Template_Loader::render_layout_header();

if ($data instanceof PufferGo_Woo_Product_Data) {
    $GLOBALS['product'] = $data->product;
    wp_enqueue_script('puffergo-product-gallery');
    $variant_id = PufferGo_Template_Loader::get_active_content_template('woo-product-single');
    $template_file = PufferGo_Template_Loader::get_content_template_file('woo-product-single', $variant_id);
    PufferGo_Template_Loader::render_content_variant_isolated('woo-product-single', $variant_id, $template_file, array('data' => $data));
} else {
    echo '<main class="puffergo-fullpage-layout puffergo-content-wrapper"><p>' . esc_html__('Product not found.', 'puffergo') . '</p></main>';
} PufferGo_Template_Loader::render_layout_footer();
