/* 
Theme Name: Hello Elementor Child
Theme URI: https://github.com/elementor/hello-theme/
Description: Hello Elementor Child is a child theme of Hello Elementor, created by Elementor team
Author: Elementor Team
Author URI: https://elementor.com/
Template: hello-elementor
Version: 1.0.1
Text Domain: hello-elementor-child
License: GNU General Public License v3 or later.
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Tags: flexible-header, custom-colors, custom-menu, custom-logo, editor-style, featured-images, rtl-language-support, threaded-comments, translation-ready
*/

/*
    Add your custom styles here
*/

function require_login_for_shop() {
    if ( ! is_user_logged_in() ) {
        if ( is_shop() || is_product() || is_product_category() || is_product_tag() ) {
            $account_page_url = add_query_arg( 'shop_login', 'true', get_permalink( get_option('woocommerce_myaccount_page_id') ) );
            wp_redirect( $account_page_url );
            exit;
        }
    }
}
add_action( 'template_redirect', 'require_login_for_shop' );

add_action( 'woocommerce_before_customer_login_form', function() {
    if ( isset( $_GET['shop_login'] ) ) {
        wc_print_notice( __( 'Log in om de webshop te bekijken.', 'woocommerce' ), 'notice' );
    }
});
