1 Commits
Author SHA1 Message Date
Geoff TaylorandGitHub 3ca56162bb fix: prevent WooCommerce session creation on CORS preflight OPTIONS requests (#992)
Move session initialization from graphql_process_http_request hook to
init_graphql_request hook with an is_graphql_http_request() guard.

graphql_process_http_request fires before WPGraphQL's OPTIONS check in
Router::process_http_request(), causing wc_load_cart() to create a new
session for every preflight request. init_graphql_request fires inside
Request constructor which is only instantiated after the OPTIONS exit.

The is_graphql_http_request() guard ensures initialize_session_and_cart()
only runs for actual HTTP requests, not programmatic graphql() calls in
tests or internal usage.
2026-03-24 03:06:02 -04:00