Default variant added when using API

nilssonnilsson Member Posts: 2

We are creating new products in our shop using the documentation found here:

We are running into one small problem taking this route; Lightspeeds seems to add a "Default" variant with a price of 0.00 to every new product created through the API.

We don't want these variants, and it would be preferable if they weren't created at all. Removing them by hand is inconvenient, and removing them using the API adds extra API calls to the process and lets the rate limit kick in faster which we also find inconvenient.

Right now the order we use is;

POST the new product to Lightspeed. 
POST one or more Variants linked to the new product to Lightspeed.

Is there a way to change our script so the default variant isn't created?


  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 627 moderator
    Hey @nilsson, whether you create the product manually using the UI, or via the API a default variant is created.

    Every variation of a product is a variant including the original; the app automatically sets the default attributes of that default variant to a price of 0 and a quantity of 100. You'll need to hit the variants endpoint and update the default variant by sending a POST request to the Variant endpoint with a payload similar to this:

      "variant": {
        "isDefault": true, //Defines whether this variant is the default one set on the product. If not set to true and specify the variant ID.
        "sortOrder": 1,
        "articleCode": "",
        "ean": "",
        "sku": "",
        "hs": "",
        "priceExcl": 0, //Insert prices here
        "priceIncl": 0,//Insert Prices here
        "priceCost": 0,
        "oldPriceExcl": 0,
        "oldPriceIncl": 0,
        "stockTracking": "disabled",
        "stockLevel": 0,
        "stockAlert": 0,
        "stockMinimum": 0,
        "stockSold": 0,
        "stockBuyMinimum": 1,
        "stockBuyMaximum": 10000,
        "weight": 0,
        "volume": 0,
        "colli": 1,
        "sizeX": 0,
        "sizeY": 0,
        "sizeZ": 0,
        "title": "Default",
        "tax": 18213,
        "product": [Insert Product ID here]
      } }

    You can read more about this endpoint and the respective parameters it accepts here: You can read more about this in our variant endpoint documentation here:

    Adrian Samuel

    Software Developer - Strategic Solutions

    Lightspeed HQ

  • nilssonnilsson Member Posts: 2
    Alright, If I understand correctly instead of performing a POST for a product, followed by a POST for a new variant I should be performing a POST for a new product, followed by a PUT to update the default variant to it actually represents a variant I want to have published in the store.

    I will try this approach tomorrow, thank you.
  • rudiwerrudiwer Member Posts: 2


    I run also in this problem but the problem is that the default created variant has id false ? so how can i reachthe endpoint of that variant if it has no id ?

  • IntensoIntenso Member Posts: 1

    Running into the same problem. Unfortunately, @Adrian Samuel's answer doesn't really make sense:

    "You'll need to hit the variants endpoint and update the default variant by sending a POST request to the Variant endpoint"

    Doing a POST request to the Variant endpoint only creates a new variant, it cannot be used to update an existing variant.

    I guess the best option we have right now is to:

    • Create a new product (POST)
    "variants": {
      "resource": {
        "id": false, --> we need the variant ID, but it's false!
        "url": "variants?product=PROD_ID",
        "link": ""
    • Get all variants for the product (GET), just to get the ID of the variant
    • Update the default variant (PUT)

    Very inefficient indeed.

Sign In or Register to comment.