Can't update oldPriceIncl or oldPriceExcl

HiddeHidde Posts: 15Member, Partner partner

Hi!

When updating variants through the variantBulk method, the oldPriceIncl or oldPriceExcl won't update.

I tried the following as stated in the documentation:

$api->variantsBulk->update(
     [
       [
         "id"      => $variant_id,
         "stockLevel"  => 10,
         "priceIncl"   => 100,
         "oldPriceIncl" => 110
       ]
     ]
);

But only the stockLevel and priceIncl are updated. The oldPriceIncl is not getting updated.

Am I doing something wrong? Or is this a bug in the eCom API?

Hidde Schuurman | Lightspeed App Developer bij InStijl Media | Gold Partner Lightspeed

2 comments

  • TimBloembergenTimBloembergen Posts: 38Moderator, Lightspeed Staff moderator
    edited February 19

    Hi Hidde,

    I've just tested this and it works a bit wonky for some reason. If you do not send the oldPriceExcl along with the oldPriceIncl, the values do not get updated.

    A workaround for this issue is that you can just send the `oldPriceExcl` field with a value of 0. The platform will automatically calculate the proper excl prices.

    Payload

    {
        "variant": [
            {
                "id" : 173723504,
                "stockLevel" : 10,
                "priceIncl" : 100,
                "oldPriceIncl" : 200,
                "oldPriceExcl" : 0
            }
        ]
    }
    

    Response

    "oldPriceExcl": 165.2893,
    "oldPriceIncl": 200,
    

    It's a bug but not a high priority one.

    Tim Bloembergen
    API Integrations Specialist
    Lightspeed HQ
  • HiddeHidde Posts: 15Member, Partner partner

    Hi Tim,

    Thanks for the solution! I'll try this.

    Hidde Schuurman | Lightspeed App Developer bij InStijl Media | Gold Partner Lightspeed
Sign In or Register to comment.