Issue with updating variants in bulk

w_van_damw_van_dam Member Posts: 3

Hello,

We use the Lightspeed eCom API via PHP. We try to update the prices of the variants in bluk. The priceExcl does get updated but the oldPriceExcl does not get updated on any variants. We send the data like this:

[
  [
    "id" => 11111111
    "priceExcl" => 959.0
    "oldPriceExcl" => 1200.0
  ],  
  [
    "id" => 1111112
    "priceExcl" => 959.0
    "oldPriceExcl" => 1200.0
  ],
  ...
]

5 comments

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 710 moderator

    Hi @w_van_dam,

    Thank you for contacting us.

    I see you're using an array in an array, please use the convention like we're mentioning in our documentation like:

    {
        "variant": [
            {
                "id" : 1,
                "stockLevel" : 10,
                "priceIncl" : 100,
                "priceExcl" : 82.6,
                "oldPriceIncl" : 110,
                "oldPriceExcl" : 90.86,
                "priceCost" : 95
            },
            {
                "id" : 2,
                "stockLevel" : 4,
                "priceIncl" : 50,
                "priceExcl" : 41.3,
                "oldPriceIncl" : 55,
                "oldPriceExcl" : 45.43,
                "priceCost" : 39
            }
        ]
    }
    


  • w_van_damw_van_dam Member Posts: 3

    Hello @LucienVersendaal , thanks for responding

    Im sorry, that is the array that we give to the WebshopApiClient using seoshop/seoshop-php. See below for the data that is transmitted to the lightspeed endpoint

    {
      "variant": [
        {
          "id": 1, 
          "priceExcl": 959, 
          "oldPriceExcl": 1200
        }, 
        {
          "id": 2, 
          "priceExcl": 180, 
          "oldPriceExcl": 200
        },
        ...
      ]
    }
    
  • Ali_MasoumieAli_Masoumie Moderator, Lightspeed Staff Posts: 66 moderator

    Hi @w_van_dam ,

    Can you add "oldPriceIncl" and try again. That should solve your issue.

    Example:

    {
      "variant": [
        {
          "id": 1, 
          "priceExcl": 959, 
          "oldPriceExcl": 1200,
          "oldPriceIncl": 1452
        }, 
        {
          "id": 2, 
          "priceExcl": 180, 
          "oldPriceExcl": 200,
          "oldPriceIncl": 242
        },
        ...
      ]
    }
    


  • w_van_damw_van_dam Member Posts: 3
    edited February 22

    Thank you for your response, @Ali_Masoumie ,

    That does resolve the issue, thanks. I dont use this value when updating a single variant and it stores the price correctly. Should I use the "oldPriceIncl" as well when updating a single variant?

  • Ali_MasoumieAli_Masoumie Moderator, Lightspeed Staff Posts: 66 moderator

    For single variants, the tax will be automatically calculated so it is not necessary to add "oldPriceIncl".

Sign In or Register to comment.