I just found out why it was not working for me.
Since I wanted to publish the site, but the shop is not ready yet, I had saved all the WooCommerce pages as drafts (shop, cart, checkout and account).
By publishing these pages as private the problem disappeared and now all pages are fine.