The big sale is on! Save up to 40% on themes and extensions in the WooCommerce Marketplace. 💰📈🥂
Product Icon

Product Add-Ons for WooCommerce

Offer add-ons like gift wrapping, special messages or other special options for your products.

Issue: Add-on Data Not Passed Correctly When Using Store API /batch Endpoint

I’ve been testing WooCommerce’s Store API together with the Product Add-Ons plugin.

I created two different products that both have required add-ons (for example, “Select a size” or “Choose an engraving text”).

When I try to add multiple products to the cart at once using the /wc/store/v1/batch endpoint — as described in the documentation (“Product Add-Ons provides seamless integration with WooCommerce’s Store API”) — the add-on data doesn’t seem to be sent properly for each product.

The Store API returns an error saying that a required add-on is missing, even though the data is clearly included in the request body.

If I add the same product individually using the /wc/store/v1/cart/add-item endpoint, it works perfectly and the add-ons are added to the cart as expected.

Example Request Body

Below is an example of what I’m sending to /wc/store/v1/batch:

{
“requests”: [
{
“path”: “/wc/store/v1/cart/add-item”,
“method”: “POST”,
“cache”: “no-store”,
“body”: {
“id”: 1787,
“quantity”: 1,
“variation”: [
{
“attribute”: “color”,
“value”: “Astral Purple”
}
],
“addons_configuration”: {
“1757916600”: 0
}
}
},
{
“path”: “/wc/store/v1/cart/add-item”,
“method”: “POST”,
“cache”: “no-store”,
“body”: {
“id”: 1790,
“quantity”: 1,
“addons_configuration”: {
“1757916700”: 1
}
}
}
]
}

Example Response / Error

When the request above runs, WooCommerce returns an error like this for the product that has a required add-on:

{
“code”: “woocommerce_rest_cart_invalid_product_addons”,
“message”: “”Multiple Choice Title” is a required field.”,
“data”: {
“status”: 400
}
}

But when I send the same body directly to /wc/store/v1/cart/add-item (outside of batch mode), it works fine — no errors.

What Seems to Be Happening

The issue seems to come from how WooCommerce handles requests inside the Batch API.

When the batch request is processed, WooCommerce creates internal “sub-requests” for each requests[] entry.
However, those internal requests don’t contain the original JSON body — instead, they are built using parsed parameters.

Because of that, the Product Add-Ons plugin, which looks for data using $wp_rest_request->get_json_params(), can’t find the addons_configuration field, and it thinks the required add-on is missing.

Why This Happens (Technically)

Inside WooCommerce’s batch processor (WC_REST_Batch_Controller), sub-requests are created with something like:

$sub_request->set_body_params( $body );

instead of

$sub_request->set_body( wp_json_encode( $body ) );

That means the raw JSON body never exists in the internal request, so functions that depend on it — like $wp_rest_request->get_json_params() — return empty arrays.

In Short

– The /wc/store/v1/cart/add-item endpoint works fine with add-ons when called directly.
– The same payload fails when sent via /wc/store/v1/batch.
– The add-on data is included in the request, but not passed through to the add-on handler because of how sub-requests are built inside the batch processor.

Screenshots

Author

tanvirinquiries

Current Status

Open

Last updated: October 9, 2025

1 comment

Log in to comment on this feature request.

  1. orhanf says:

    Hey there! Orhan here from the WooCommerce.com support team. Thank you for taking the time to put such valuable information together!

    The Product Add-Ons development team has gone over the technical details you shared and want to say that it will be considered for a future release, though we do not have an exact ETA just yet.

    For now, this has been logged internally for further technical assessment. Thanks again!