@woographql/react-hooks provides a comprehensive set of React hooks designed specifically for building headless WooCommerce storefronts. The library handles the complexities of WooCommerce session management, cart operations, and product handling so you can focus on building your storefront.
- Session Management: Full WooCommerce session handling with guest and authenticated user support
- Cart Operations: Complete cart functionality including add, update, remove, and checkout
- Product Context: Product provider with variation selection and attribute handling
- WooGraphQL Pro Support: Native support for subscription, bundle, composite, and add-on products
- Generic Type System: Full support for codegen-generated types — create application-specific providers and hooks with zero typecasting
- Framework Agnostic: Works with Next.js, Remix, and other React frameworks
The library provides several interconnected hooks that work together:
- useSessionManager: Core session state management with token handling
- useCartMutations: Product-scoped cart operations that integrate with SessionProvider
- useCartMutationsWithCart: Standalone cart operations for custom state management
- useProduct: Product context provider for single product pages
Get started by following the Getting Started guide.