WooGraphQL Product Bundles WP Registry grade C-. High-severity findings · 1 findingWP RegistryHigh-severity findings · 1 findingOpen the reportC-
Add WooCommerce Product Bundle support to your WPGraphQL schema
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/jacobarriola/woographql-product-bundles/archive/refs/heads/master.zipOn Packagist as jacobarriola/woographql-product-bundles:
composer require jacobarriola/woographql-product-bundlesAdd WooCommerce Product Bundle support to your WPGraphQL schema.
Requirements
- PHP +7.1
- WordPress +5.0
- WPGraphQL +1
- WooGraphQL +0.8.0
- WooCommerce +4.7.0
- WooCommerce Product Bundles +0.5.0
Documentation
Add To Cart Mutation
For now, add to cart is a different mutation since additional data is required. The mutation
mimics the existing WooGraphQL addToCart, with a few differences.
Essentially it attempts to mimic the underlying Product Bundles' API, which is found https://docs.woocommerce.com/document/bundles/bundles-functions-reference/#add_bundle_to_cart
mutation addToCartBundle(input: { clientMutationId: "123" quantity: 1 productId: 456789 extraData
: SEE_BELOW
} ) {
...
}
The extraData input is a JSON value.
Arguments
object index: The bundle item IDproduct_id: Product ID of the bundled itemquantity: Quantity of the bundled itemvariation_id: The variation ID of the selected variation, if applicableattributes: An object with the key asattribute_ATTRIBUTE_SLUGand the value as the attribute value, if applicable
Example:
{
"765": {
"product_id": "9876",
"quantity": "1",
"optional_selected": "yes",
"variation_id": "4321",
"attributes": {
"attribute_pa_color": "red",
"attribute_pa_size": "2xl"
}
},
"896": {
"product_id": "1234",
"quantity": "1"
}
}
In this example, the Bundle contains two Bundle Items, 765 and 896. 765 is a variable
product (designated by the product_id: 9876). The variation_id and attributes are required
. On the other hand, 896 is a simple product. It's only passing in the product_id.
Todo
- return appropriate types instead of JSON for
allowedVariationsanddefaultVariationAttributes - simplify the
addToCartBundleor merge it with the coreaddToCartmutation
Releases
4 releases.
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.