<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * 
 *
 * This is the template for Vendor store setup And vendor store page which can override any theme template
 *
 * 
 *
 * 
 */
global $rtwmer_user_id_for_dashboard;
$rtwmer_user_meta = get_user_meta(get_current_user_id(), "rtwmer_vendor_store_setup", true);
$rtwmer_user_meta = get_userdata($rtwmer_user_id_for_dashboard);
$rtwmer_roles = $rtwmer_user_meta->roles;
if ($rtwmer_roles[0] != 'administrator') {
    if (current_user_can("mercador")) {
        if (filter_var($rtwmer_user_meta, FILTER_VALIDATE_BOOLEAN)) {
?>   <!DOCTYPE html>
        <html lang="en">
            <head>
                <meta content="width=device-width, initial-scale=1.0" name="viewport">
               
                <?php wp_head(); ?>
            </head>
            <div class="rtwmer-home-wrap">
                <div class="rtwmer-site-title">
                    <a href="<?php echo esc_url(wc_get_page_permalink('shop')) ?>"><?php bloginfo('name'); ?></a>
                </div>
                <?php do_action("rtwmer_template_header"); ?>
                <div class="rtwmer-toggle-sidebar">
                    <i class="fas fa-bars"></i>
                </div>
                <div class="rtwmer-back">
                    <a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>" class="rtwmer-Url">
                        <span class="material-icons">home</span>
                    </a>
                </div>
            </div>
            <?php
            while (have_posts()) :
                the_post();
                the_content();
            endwhile;
            wp_footer();
       
            ?>
            
            </html>
        <?php
        } else {
        ?>
            <!DOCTYPE html>
            <html lang="en">

            <head>
                <?php wp_head(); ?>
            </head>

            <body class="rtwmer_store_setup_body">
                <?php
                while (have_posts()) :
                    the_post();
                    the_content();
                endwhile;
                wp_footer();
                ?>
               
            </body>

            </html>
<?php
        }
    } else {
        $rtwmer_link = get_permalink(get_option('woocommerce_myaccount_page_id'));
        header("Location:" . $rtwmer_link);
    }
} else {
    wp_die(esc_html__('Sorry, you are not authorized to access this page.','mercado'));
} ?>