I have added the product permalink in
Settings ->Permalinks to Custom Base
/shop/%product_cat% it works fine. But if I updated it to
/%product_cat% products page working fine but website pages and posts are redirecting to 404 page. Any idea?
Well, WooCommerce documentation clearly states
Please note: The product custom base should not conflict with the taxonomy permalink bases. If you set the product base to ‘shop’ for example, you should not set the product category base to ‘shop’ too as this will not be unique and will conflict. WordPress requires something unique so it can distinguish categories from products.
I think this may be a generic WP level rewrite issue: how do you match things across entity types (posts and taxonomies). There are big discussions on uh... rewriting the core rewrite systems because it has become a bottleneck https://core.trac.wordpress.org/ticket/36292 but it's probably a long-winded project.