Loading…
Loading…
Complete GraphQL support for WooCommerce Product Add-ons including all field types and cart integration.
WooGraphQL Pro provides complete GraphQL support for WooCommerce Product Add-ons, enabling customizable product options in your headless storefront.
product_addons)8 field types are supported:
| Type | Description |
|---|---|
AddonMultipleChoice | Dropdown, radio buttons, or image selector |
AddonCheckbox | Multiple checkbox options |
AddonShortText | Short text input with validation |
AddonLongText | Textarea for longer text |
AddonFileUpload | File upload field |
AddonCustomerDefinedPrice | Customer-specified price |
AddonQuantity | Quantity multiplier |
AddonHeading | Section heading (display only) |
Add-ons support multiple pricing methods:
| Type | Values |
|---|---|
ProductAddonFieldEnum | MULTIPLE_CHOICE, CHECKBOX, SHORT_TEXT, LONG_TEXT, FILE_UPLOAD, CUSTOMER_DEFINED_PRICE, QUANTITY, HEADING |
ProductAddonPriceAdjustEnum | FLAT_FEE, QUANTITY_BASED, PERCENTAGE_BASED |
ProductAddonDisplayAsEnum | DROPDOWNS, RADIO, IMAGES |
ProductAddonTitleFormatEnum | LABEL, HEADING, HIDE |
ProductAddonShortTextRestrictionEnum | ANY_TEXT, ONLY_LETTERS, ONLY_NUMBERS, ONLY_LETTERS_AND_NUMBERS, EMAIL |
| Type | Description |
|---|---|
ProductAddonInput | Add-on selection when adding to cart |
| Type | Description |
|---|---|
ProductAddonField | Interface for all addon types |
ProductAddonOption | Option for choice-based addons |
ProductAddonIntegerRange | Min/max integer range |
ProductAddonFloatRange | Min/max float range |
query GetProductWithAddons($id: ID!) { product(id: $id, idType: DATABASE_ID) { id name price addons { fieldName name type required price priceType ... on AddonMultipleChoice { choiceType options { label price priceType image { sourceUrl } } } ... on AddonShortText { restrictions characterLimit { min max } } ... on AddonCheckbox { options { label price priceType } } } } }
mutation AddToCartWithAddons($productId: Int!, $addons: [ProductAddonInput!]) { addToCart( input: { productId: $productId quantity: 1 addons: $addons } ) { cart { total } cartItem { key quantity total extraData { key value } } } }
Variables:
{ "productId": 123, "addons": [ { "fieldName": "addon_123_engraving", "value": ["Custom Text Here"] }, { "fieldName": "addon_123_gift_wrap", "value": ["Yes"] } ] }
WooGraphQL Pro provides mutations for managing global product addon groups:
createGlobalProductAddon - Create a global addon groupupdateGlobalProductAddon - Update an existing groupdeleteGlobalProductAddon - Delete a groupSee the Mutations Reference for full details.
All product CRUD mutations (createProduct, updateProduct, createBundleProduct, createSubscriptionProduct, createCompositeProduct, and their update variants) accept:
| Field | Type | Description |
|---|---|---|
addons | [ProductAddonDefinitionInput] | Per-product addon definitions |
excludeGlobalAddons | Boolean | Exclude global addons from this product |
See the Mutations Reference for input type details.