Loading…
Loading…
Complete GraphQL support for WooCommerce Composite Products including components, scenarios, and the addCompositeToCart mutation.
WooGraphQL Pro provides complete GraphQL support for WooCommerce Composite Products, enabling you to build headless storefronts with sophisticated configurable products.
composite_products)Query and display composite products with:
Access component configuration including:
Conditional logic support:
Add composites to cart with full configuration:
| Type | Values |
|---|---|
CompositeProductLayoutEnum | STACKED, PROGRESSIVE, STEPPED, COMPONENTIZED |
CompositeProductFormLocationEnum | DEFAULT, BEFORE_TABS |
CompositeProductShopPriceCalcOptions | USE_DEFAULTS, CALCULATE_FROM_TO, HIDE |
CompositeProductComponentOptionsTypeEnum | SELECT_PRODUCTS, SELECT_CATEGORIES |
CompositeProductComponentOptionStyleEnum | DROPDOWN, THUMBNAILS, RADIO_BUTTONS |
CompositeProductComponentPaginationStyleEnum | CLASSIC, LOAD_MORE |
CompositeProductComponentOptionSelectActionEnum | VIEW_SELECTION_DETAILS, VIEW_NEXT_STEP |
CompositeProductScenarioConditionCompareEnum | IS, IS_NOT, IS_ANY |
| Type | Description |
|---|---|
CompositeProductConfigurationInput | Configure a component when adding to cart |
| Type | Description |
|---|---|
CompositeProduct | Composite product type with all fields |
CompositeProductComponent | Component configuration and options |
CompositeProductScenario | Conditional behavior rules |
CompositeCartItem | Cart item type for composites |
query GetCompositeProduct($id: ID!) { product(id: $id, idType: DATABASE_ID) { ... on CompositeProduct { id name price layout editableInCart components { componentId title description optional pricedIndividually minQuantity maxQuantity defaultQuantity discount optionsStyle queryOptions { nodes { id name price } } defaultOption { id name } } } } }
mutation AddCompositeToCart( $productId: Int! $configuration: [CompositeProductConfigurationInput!]! ) { addCompositeToCart( input: { productId: $productId quantity: 1 configuration: $configuration } ) { cart { total } cartItem { key quantity total components { component { title } productId quantity } } } }
Variables:
{ "productId": 123, "configuration": [ { "componentId": "1", "productId": 456, "quantity": 1 }, { "componentId": "2", "productId": 789, "quantity": 2 } ] }
addCompositeToCart mutation