<?php
/**
 * Watson WooCommerce Functions
 *
 * @package Watson
 * @version 1.0.0
 */

defined( 'ABSPATH' ) || exit;


function watson_register_shop_sidebar() {
    register_sidebar(array(
        'name'          => 'Watson Shop Sidebar',
        'id'            => 'watson-shop-sidebar',
        'description'   => esc_html__('Add widgets here to appear in your shop sidebar.', 'watson'),
        'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget'  => '</div>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ));
}
add_action('widgets_init', 'watson_register_shop_sidebar');


function watson_disable_woocommerce_template() {
   
    remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
    remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
}
add_action( 'init', 'watson_disable_woocommerce_template' );


function watson_woo_get_page_id() {
    if ( is_shop() || is_product_category() || is_product_tag() ) {
        return wc_get_page_id( 'shop' );
    } elseif ( is_cart() ) {
        return wc_get_page_id( 'cart' );
    } elseif ( is_checkout() ) {
        return wc_get_page_id( 'checkout' );
    } elseif ( is_account_page() ) {
        return wc_get_page_id( 'myaccount' );
    } elseif ( is_product() ) {
        global $post;
        return $post->ID;
    }
    return 0;
}
