P
P
Pavel Bigel2019-03-13 16:16:14
C++ / C#
Pavel Bigel, 2019-03-13 16:16:14

How to add Woocomerce product attribute without knowing its id?

I am making my own commerceML upload algorithm on .net core, I have parsed its values ​​and I have product properties and a group of properties.
According to the Woocomerce API documentation, adding a product attribute and its value is as follows

"attributes": [
    {
      "id": 6,
      "position": 0,
      "visible": false,
      "variation": true,
      "options": [
        "Black",
        "Green"
      ]
    },
    {
      "name": "Size",
      "position": 0,
      "visible": true,
      "variation": true,
      "options": [
        "S",
        "M"
      ]
    }
  ],

However, if the product attribute is added without specifying its id, then it becomes individual , which makes it impossible to make any filter on it.
Question: How can I add a product attribute without its id, binding it to existing attributes?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question