Sylius API - Patch product with attribute (type select) - Stack Overflow

admin2025-04-22  2

With the Sylius API v1 PATCH api/v1/products/XXX

I need to add an AttributeValue. No problem with attributes of type text, but this one is a type select.
So I try to send an array, but here is the error I get :

{
    "code": 500,
    "message": "A cycle was detected. Listeners to the PRE_SET_DATA event must not call getNormData() if the form data has not already been set."
}

Here is my json for the call :

{
  "channels": ["LOCAL_WEB"],
  "attributes": [
    {
      "attribute": "flavour",
      "localeCode": "en_GB",
      "value": [
        "83469a4804a9966ecc29161878526b3c",
        "f865e0aed8912eee57d84e673246efd9"
      ]
    }
  ],
}

I tried multiple structure for the value, but no one is working. Also I can't find any documentation about this specific case.

Also, here is the attribute configuration (type: select, storage_type: json)

{
  "multiple": true,
  "choices": {
    "83469a4804a9966ecc29161878526b3c": {
      "en_GB": "vanilla"
    },
    "caf973c16410b87b3a996405f421ec14": {
      "en_GB": "chocolate"
    },
    "f865e0aed8912eee57d84e673246efd9": {
      "en_GB": "pistachio"
    }
  },
  "min": 1,
  "max": 10
}

EDIT
Actually, it works if the product has no attribute. The problem happens when the product already has attributes

转载请注明原文地址:http://anycun.com/QandA/1745303551a90613.html