How to access SKU dimension fields with BigCommerce API - bigcommerce

I'm using BigCommerce's v2 API. I notice in the BigCommerce control panel that users can enter depth, width, and height values for a specific SKU. However, the SKU api endpoint does not seem to return these fields. This is the response from the endpoint /products/310/skus/10549:
{
"id": 10549,
"product_id": 310,
"sku": "testsku123",
"price": null,
"adjusted_price": "15.0000",
"cost_price": "0.0000",
"upc": "",
"inventory_level": 0,
"inventory_warning_level": 0,
"bin_picking_number": "",
"weight": null,
"adjusted_weight": "4.5000",
"is_purchasing_disabled": false,
"purchasing_disabled_message": "",
"image_file": "",
"options": [{
"product_option_id": 2292,
"option_value_id": 3158
}]
}
There are no fields for depth, width, or height, even though those values are set for this SKU in the control panel. Is there some other way to access these fields? Are there plans to make them available?

You can access width, height and depth on the SKU level with the v3 API (that's the version of the API that's being consumed when you enter those dimensions on the SKU level through the control panel). Here's a link to the documentation on the v3 variable object:
https://developer.bigcommerce.com/api/v3/object-models.html#variant
https://developer.bigcommerce.com/api/v3/catalog.html#getvariantbyid

Related

big commerce Wish Lists not exposed on category template

I am trying to add wish list functionality to the Big Commerce category.html. I have exposed wish lists to the page using the below frontmatter, but customer.wishlists always returns null instead of a list of wish lists (my user has two created).
Frontmatter - category.html
---
category:
shop_by_price: true
products:
limit: {{theme_settings.categorypage_products_per_page}}
customer:
wishlists:
limit: 10
---
Context
"customer": {
"id": 1,
"name": "user name",
"email": "user#email.co.uk",
"phone": "",
"store_credit": {},
"shipping_address": {},
"recently_viewed_products": null,
"wishlists": null,
Anyone have ideas of why this isn't returning the correct data? Have I missed a step maybe?

How to get a product / variant "committed" inventory?

Problem:
On the Shopify Admin, section Products > Inventory, there's a "committed" inventory.
Based on my comprehension it means "reserved stock for pending orders", or "inventory reserved by orders created but not yet completed".
This "committed" stock value can be very useful for stock updates by app. But pratically this value seems hard to retreive.
Question:
How to get this "committed" inventory value in an efficient way ?
Current state of researchs :
Not possible via Shopify APIs (REST & GraphQL, version 2022-07)
Can be approximated (not sure it's the right method) by looping over all unfulfilled orders, and sum up (by variant) the unfulfilled product variant quantity. However, it takes time and consumes a lot of API resources.
According to a Shopify Community Manager (ref. post)
The Committed inventory state isn't added to the API currently.
It's possible now in the 2023-01 version of the API. The InventoryLevel got a new field quantities, which returns this for a product with a total stock of 10 and two sold:
[
{
"quantity": 8,
"name": "available"
},
{
"quantity": 2,
"name": "committed"
},
{
"quantity": 0,
"name": "incoming"
},
{
"quantity": 10,
"name": "on_hand"
},
{
"quantity": 0,
"name": "reserved"
}
]

How to add modifiers to cart line item in BigCommerce Api

I already tried the solution given in this Cart API V3: Can't create a Cart for product that has options link but it's not working for me.
modifier is extra fitting added to the product like "name tag" for suitcase.
I tried to add the modifier in "option_selections" like below but it returns 422 error.
Request:
{
"quantity":"1",
"product_id":"5846",
"variant_id":150922,
"list_price":" 170.00",
"option_selections":[{"option_id":23800, "option_value":"10088"}]
}
Response:
StatusCode: 422, ReasonPhrase: 'Unprocessable Entity'
Thanks for your reply in advance.
If you're creating a new cart, try this request body (POST to /carts endpoint):
{
"line_items": [
{
"quantity": 1,
"product_id": 76,
"list_price": 170.00,
"option_selections": [
{
"option_id": 21506,
"option_value": 10090
}
]
}
]
}
You shouldn't have quotes around any of these field values--list_price, product_id, etc all accept a number, not a string.
If you want to add a new line item to an existing cart, you can use the same request body as above. The request will be a POST to carts/{cartID}/items
EDIT:
If you are updating a line item that already exists in the cart, you'll want to make a PUT to /carts/{cartID}/items/{itemID}.
Request body:
{
"line_item": {
"quantity": 1,
"product_id": 76,
"list_price": 170.00,
"option_selections": [
{
"option_id": 21506,
"option_value": 10090
}
]
}
}
Note: it does need to be "line_item" rather than "line_items" when updating a single cart item. I'll work with our documentation team to get this updated in the API reference.
I was able to solve the issue, though I agree with Karen White's answer, I wanted to add a product which has options like colors and modifiers too. Which I was not able to achieve with that. I used the following data to add product with option and modifier.
Instead of passing variant_id, pass variant as option (option_id gets option's id and option_value gets option value's id) and pass modifier as option (modifier option_id gets option's id and option_value gets option value's id)
{
"line_items": [{
"quantity": 1,
"product_id": 5846,
"option_selections": [{
"option_id": 23799,
"option_value": 10173
}, {
"option_id": 23800,
"option_value": 10088
}]
}]
}

Is there a way to get more information for a Steam game through API like ratings or tags?

I know that you can get quite a lot of information with calling:
http://store.steampowered.com/api/appdetails?appids=57690
But it is still missing data which available on the store page like rating, tags, etc. is there a parameter or another way to get more information about a game?
Yes, you can extract ratings information with the Steamworks User Reviews - Get List endpoint.
For example, to get info about CS:GO:
GET https://store.steampowered.com/appreviews/10?json=1&language=all
{
"success": 1,
"query_summary": {
"num_reviews": 20,
"review_score": 9,
"review_score_desc": "Overwhelmingly Positive",
"total_positive": 25703,
"total_negative": 898,
"total_reviews": 26601
},
"reviews": [
{
"recommendationid": "122478997",
"author": {
"steamid": "76561198072280507",
"num_games_owned": 3,
"num_reviews": 2,
"playtime_forever": 503225,
"playtime_last_two_weeks": 0,
"playtime_at_review": 503224,
"last_played": 1663589422
},
"language": "english",
"review": "God dam what a game",
"timestamp_created": 1663588856,
"timestamp_updated": 1663588856,
"voted_up": true,
"votes_up": 11,
"votes_funny": 2,
"weighted_vote_score": "0.643105804920196533",
"comment_count": 0,
"steam_purchase": true,
"received_for_free": false,
"written_during_early_access": false,
"hidden_in_steam_china": true,
"steam_china_location": ""
}
],
"cursor": "AoIFP+vAcEAAAAB6htXVAw=="
}
The query_summary returns global rating information about the game.
No, there isn't a public api endpoint for rating/tags etc.
The link you send isn't even officially supported by Valve as an API endpoint and is rate limited.
You can read through here for all the API endpoints of Steam, but the one you are using now is the only one with most of the game data in detail.

BigCommerce Stencil - Retrieve Product Custom Fields in Product Card

I'm trying to retrieve each product's custom_fields data on the category list pages in BigCommerce Stencil. This documentation here, and the JSON product representation below, would suggest this is not possible.
It is hard for me to believe this functionality would be left out of Stencil, considering it was available in Blueprint.
{
"id": 691,
"name": "Archipelago Botanicals - Pomegranate Lip Gloss",
"url": "http://******.mybigcommerce.com/archipelago-botanicals-pomegranate-lip-gloss/",
"brand": {
"name": "Archipelago Botanicals"
},
"rating": 0,
"availability": "",
"summary": "Pomegranate lip gloss leaves lips hydrated, shiny and smooth. Apply liberally.Net Weight: 0.42 oz. / 12 g Mineral Oil, Polybutene, Octyidodecanol, Butylene, Ethylene, Styrene Copolymer, Ethylene, Propylene, Styrene Copolymer, C18-36 Acid Triglycerides, Fr",
"image": {
"data": "https://cdn3.bigcommerce.com/*****/images/stencil/{:size}/products/691/41439/arbopolipgl__77026.1464267682.jpg?c=2",
"alt": "Archipelago Botanicals - Pomegranate Lip Gloss"
},
"date_added": "Apr 7th 2016",
"qty_in_cart": 0,
"pre_order": false,
"has_options": false,
"show_cart_action": false,
"price": {
"without_tax": {
"formatted": "$5.00",
"value": 5
},
"rrp_without_tax": {
"formatted": "$12.50",
"value": 12.5
},
"saved": {
"formatted": "$7.50",
"value": 7.5
},
"tax_label": "Tax"
}
},
Am I missing something, or is this functionality not available on Stencil at this time?
Has anyone come up with a creative solution to retrieve this data inside each product card?
Thanks
The product card now allows this to be exposed. It provides an array of all custom fields associated with a product. Information on the product card object is here.
It was a change that had to be made in the BC core app and the fix was released on Sept 20th