Marketplaces / Big Commerce Technical Scope / Big Commerce Product Management / Big Commerce Update Product Variant

Big Commerce Update Product Variant

Summary of Changes: (The purpose of this table is to keep traceability and Product team to highlight the things that were changed into the scope, based on comments or discussions)

Date Version Name Applied changes
12/12/2023 v1.0 Bogomil Pavlov First Publish
19.01.2024 v1.1 Bogomil Pavlov Item Closed additional logic

In order to update the product details and the variant details we will have to use two separate requests. To automate the flow there will be some additional logic for all variations when we are doing full updates. Basically if we have a product with Product Account > Variation Group populated we would have to update the product information using Big Commerce Update Product and if we receive success response we would like to set Product Account Big Commerce > Variant Update = Pending which will be our trigger for Update Product Variants. If the Update Product returns an error we would like to handle it as per standard across all variants and do NOT set Account Big Commerce > Variant Update = Pending.

If we have Account Big Commerce > Variant Update = Pending and the variant is published we would like to update the variant information as per below. We would like to go through the “Sent” status for this field as we do with similar fields as Update Price or Update Quantity.

All updates are per variant. We want all triggers, validations and standardisations to be as per Product Listing general requirements

API Call: PUT https://api.bigcommerce.com/stores/{store_hash}/v3/catalog/products/{product_id}/variants/{variant_id} Doc: https://developer.bigcommerce.com/docs/rest-catalog/product-variants#update-a-product-variant

Sample Request: PUT https://api.bigcommerce.com/stores/q4sg1rg/v3/catalog/products/119/variants/93

Big Commerce Field Hemi Field Required Comment
product_id Product Account > Channel Item Id Yes
variant_id Product Account Big Commerce > Variant Id Yes

Sample Request:

{
  "cost_price": 30,
  "price": 40,
  "sale_price": 50,
  "purchasing_disabled": false,
  "upc": "12345678",
  "inventory_level": 2,
  "inventory_tracking": "variant",
  "mpn": "1234567890",
  "gtin": "012345678905",
  "sku": "765124q3",
  "option_values": [
    {
      "option_display_name": "Color",
      "label": "Beige"
    },
    {
      "option_display_name": "Size",
      "label": "42"
    }
  ]
}

Request Mapping:

Big Commerce Field Hemi Field Required Comment
cost_price Product Account > Original Price No
price Product Account > Price

OR Product Account > RRP | No | If RRP <= Price we push Product Account > Price If RRP > Price we push Product Account > RRP | | sale_price | | Product Account > Price | No | If RRP > Price we want to push this field as Product Account > Price If RRP <= Price we include the sale_price with value 0 | | purchasing_disabled | | “false“ | Yes | Hardcoded as “false“ | | upc | | Product > UPC | No | | | inventory_level | | Product Account > Quantity | No | | | inventory_tracking | | “variant“ | No | Hardcoded as “variant“ | | mpn | | Product > MPN | No | | | gtin | | Product > EAN Or Product Account >Marketplace EAN | No | Product Account >Marketplace EAN with priority | | sku | | Product > SKU | Yes | | | option_values | | | | | | | option_display_name | Product Account > Variation Specific Name | Yes | | | | label | Product Account > Variation Specific Value | Yes | |

Sample Response: Status 200 OK

{
    "data": {
        "id": 92,
        "product_id": 119,
        "sku": "765124q3",
        "sku_id": 134,
        "price": 40,
        "calculated_price": 50,
        "sale_price": 50,
        "retail_price": 60,
        "map_price": null,
        "weight": null,
        "calculated_weight": 1,
        "width": null,
        "height": null,
        "depth": null,
        "is_free_shipping": false,
        "fixed_cost_shipping_price": null,
        "purchasing_disabled": false,
        "purchasing_disabled_message": "",
        "image_url": "",
        "cost_price": 30,
        "upc": "12345678",
        "mpn": "1234567890",
        "gtin": "012345678905",
        "inventory_level": 2,
        "inventory_warning_level": 0,
        "bin_picking_number": "",
        "option_values": [
            {
                "id": 111,
                "label": "White",
                "option_id": 120,
                "option_display_name": "Color"
            },
            {
                "id": 113,
                "label": "42",
                "option_id": 121,
                "option_display_name": "Size"
            }
        ]
    },
    "meta": {}
}

When success response is received, Account Big Commerce > Variant Update should be set to “Not Needed” together with the Update Quantity and Update Price flags. The last two should be updated only if they have been sent into the payload (read additional information below).

Additional Information:

In order to handle the protect flags correct BigCommerce allow us to push the product update without the price and quantity information thus we would like to exclude them from the payload in the following cases.

Protect Price - If we have protect price = True (Yes) we want to exclude from the payload price, cost_price, sale_price this way we can update the other product information

Protect Quantity - If we have protect quantity = True (Yes) we want to exclude from the payload inventory_level, inventory_tracking this way we can update the other product information.

If we have both Protect Price and Protect Quantity = True (Yes) we want to exclude from the payload inventory_level, inventory_tracking, price, cost_price, sale_price this way we can update the other product information..

<v1.1>Closed - The correct handle in such cases where we are updating all variants with single update because of the structure of their platform “Closed“ should work in the same way as well. If we have a listing with 3 variants and only one of them is set as Closed = Yes we stop the updates for the whole listing.</v1.1>

All other flags should work as per our general abstraction.

Sample Error Response #1:

{
    "status": 404,
    "code": 22001,
    "title": "No variants with id 97 found for product id 119",
    "type": "https://developer.bigcommerce.com/api-docs/getting-started/api-status-codes"
}

Sample Error Response #2:

{
    "status": 400,
    "title": "Input is invalid",
    "type": "https://developer.bigcommerce.com/api-docs/getting-started/api-status-codes",
    "errors": {}
}

We want to store the title as error in Product Account > Update Item Error but only for the variant for which we have just sent an update (we don’t need to store it for the whole variation in this case).

Is this article helpful?
0 0 0