M
M
makboriska2022-02-02 11:52:09
WordPress
makboriska, 2022-02-02 11:52:09

What is the best way to import from json file in woocommerce?

The essence of the question is this:
- I have a json file with a product (- and), an array with a product:

[
  {
    "id": 8860335000797,
    "name": "Bilko",
    "model": "Sun Odyssey 509",
    "modelId": 428155400797,
    "shipyardId": 5,
    "year": 2020,
    "kind": "Gulet",
    "homeBaseId": 429492270000100000,
    "homeBase": "ACI Marina Split",
    "companyId": 797,
    "company": "DemoMMK",
    "draught": 2,
    "beam": 3.82,
    "length": 12.8,
    "waterCapacity": 200,
    "fuelCapacity": 170,
    "engine": "750 hp",
    "deposit": 2000,
    "commissionPercentage": 17,
    "wc": 2,
    "berths": 12,
    "cabins": 8,
    "mainsailArea": 75.34,
    "genoaArea": 28,
    "mainsailType": "Furling",
    "genoaType": "Self Tacking Jib",
    "defaultCheckInDay": 1,
    "images": [
      {
        "description": "Interior image",
        "url": "http://www.booking-manager.com/image123",
        "sortOrder": 1
      }
    ],
    "equipmentIds": [
      16
    ],
    "products": [
      {
        "name": "Bareboat",
        "extras": [
          {
            "name": "Fuel",
            "obligatory": true,
            "price": 500,
            "unit": "per booking",
            "payableInBase": true,
            "includedDepositWaiver": false,
            "validDaysFrom": 0,
            "validDaysTo": 365,
            "minNumberOfPersons": 2,
            "maxNumberOfPersons": 8,
            "validForBases": [
              {
                "from": [
                  5
                ],
                "to": [
                  27
                ]
              }
            ]
          }
        ]
      }
    ],
    "cabinsLayout": [
      {
        "name": "1",
        "amount": 8
      }
    ],
    "berthsLayout": [
      {
        "name": "1",
        "amount": 8
      }
    ]
  }
]


The task is to record this product in woocommerce, but according to the structure of the database of an arbitrary product record type, it is clear that it will not be possible to do this in the normal mode (using the import of goods).

I want to record fields that are not in the product as product attributes, for example, additional services (as an attribute), the question is: How far have I moved my mind? Maybe I greatly underestimated the complexity, or maybe everything is easier than it seems?

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