Product Visibility - ordercloud

Issue
When logged in as a buyer, I am unable to see a product I should have access to. Issuing this request, /v1/me/products while passing a token for user buyer01, I see this response:
{
"Meta": {
"Facets": [],
"Page": 1,
"PageSize": 20,
"TotalCount": 0,
"TotalPages": 0,
"ItemRange": [
1,
0
],
"NextPageKey": null
},
"Items": []
}
I expect to see the product SHIRT listed in the Items array element.
Visibility rules
I've worked through the Visibility Rules Checklist and I believe all conditions have been met:
Product.Active = true
Catalog exists where:
Catalog.Active = true
Buyer is assigned via CatalogAssignment
Product is assigned via ProductCatalogAssignment
One of the following is true:
CatalogAssignment.ViewAllProducts = true
Product is active
{{baseUrl}}/v1/products returns this response:
{
"Meta": {
"Facets": [],
"Page": 1,
"PageSize": 20,
"TotalCount": 1,
"TotalPages": 1,
"ItemRange": [
1,
1
],
"NextPageKey": null
},
"Items": [
{
"OwnerID": "xxxxxxxxxxxxxxxx",
"DefaultPriceScheduleID": "SHIRT_PRICE",
"AutoForward": false,
"ID": "SHIRT",
"Name": "Cotton T-Shirt",
"Description": "A plain white, cotton shirt for everyday use.",
"QuantityMultiplier": 1,
"ShipWeight": null,
"ShipHeight": null,
"ShipWidth": null,
"ShipLength": null,
"Active": true,
"SpecCount": 0,
"VariantCount": 0,
"ShipFromAddressID": null,
"Inventory": null,
"DefaultSupplierID": null,
"AllSuppliersCanSell": false,
"Returnable": false,
"xp": null
}
]
}
Catalog is active
{{baseUrl}}/v1/catalogs returns
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 1,
"TotalPages": 1,
"ItemRange": [
1,
1
],
"NextPageKey": null
},
"Items": [
{
"ID": "BUYER_ORGANIZATION",
"OwnerID": "xxxxxxxxxxxxxxxx",
"Name": "Example Buyer",
"Description": "Default catalog for Example Buyer",
"Active": true,
"CategoryCount": 0,
"xp": null
}
]
}
Buyer is assigned
Buyer user in organization
{{baseUrl}}/v1/me (with buyer01 cookie) returns:
{
"Buyer": {
"ID": "BUYER_ORGANIZATION",
"DefaultCatalogID": "BUYER_ORGANIZATION"
},
"Supplier": null,
"Seller": {
"ID": "xxxxxxxxxxxxxxxx"
},
"ID": "BUYER_USER",
"CompanyID": "BUYER_ORGANIZATION",
"Username": "buyer01",
"Password": null,
"FirstName": "Buyer",
"LastName": "User",
"Email": "buyer#email.com",
"Phone": null,
"TermsAccepted": null,
"Active": true,
"xp": null,
"AvailableRoles": [
"MeAdmin",
"PasswordReset",
"Shopper"
],
"Locale": null,
"DateCreated": "2022-12-21T00:43:53.507+00:00",
"PasswordLastSetDate": "2022-12-21T00:43:53.543+00:00"
}
Buyer organization is assigned catalog
{{baseUrl}}/v1/catalogs/assignments returns
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 1,
"TotalPages": 1,
"ItemRange": [
1,
1
],
"NextPageKey": null
},
"Items": [
{
"CatalogID": "BUYER_ORGANIZATION",
"BuyerID": "BUYER_ORGANIZATION",
"ViewAllCategories": true,
"ViewAllProducts": true
}
]
}
Product is assigned
This may be the issue. When I make the documented assignment:
{{baseUrl}}/v1/catalogs/productassignments
{
"CatalogID": "BUYER_ORGANIZATION",
"ProductID": "SHIRT"
}
I receive a 200 response that does not show any assignment has occurred:
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 0,
"TotalPages": 0,
"ItemRange": [
1,
0
],
"NextPageKey": null
},
"Items": []
}
Note that the above request, as all other steps, is taken from the Getting Started walkthrough. This step is provided under Making Your Product Visible.
This is confirmed by this request:
{{baseUrl}}/v1/products/assignments, which returns no products.
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 0,
"TotalPages": 0,
"ItemRange": [
1,
0
],
"NextPageKey": null
},
"Items": []
}
View all products is true
{{baseUrl}}/v1/catalogs/assignments returns
{
"Meta": {
"Page": 1,
"PageSize": 20,
"TotalCount": 1,
"TotalPages": 1,
"ItemRange": [
1,
1
],
"NextPageKey": null
},
"Items": [
{
"CatalogID": "BUYER_ORGANIZATION",
"BuyerID": "BUYER_ORGANIZATION",
"ViewAllCategories": true,
"ViewAllProducts": true
}
]
}

The issue was that I was making a GET request instead of a POST when doing this:
{{baseUrl}}/v1/catalogs/productassignments
When issuing a POST, the service returns a 204 No Content.
It is worth noting that the tutorial is a bit out of date--the current Product API documentation omits the above call, and instead has /products/assignments here. This method will return a 405 Method Not Allowed an error if doing a GET, which makes this issue easier to identify.
Now when I view /me/products as buyer01 I see this:
{
"Meta": {
"Facets": [],
"Page": 1,
"PageSize": 20,
"TotalCount": 1,
"TotalPages": 1,
"ItemRange": [
1,
1
],
"NextPageKey": null
},
"Items": [
{
"PriceSchedule": {
"OwnerID": "xxxxxxxxxxxxxxxx",
"ID": "SHIRT_PRICE",
"Name": "Cotton T-Shirt Price",
"ApplyTax": false,
"ApplyShipping": false,
"MinQuantity": 1,
"MaxQuantity": null,
"UseCumulativeQuantity": false,
"RestrictedQuantity": false,
"PriceBreaks": [
{
"Quantity": 1,
"Price": 10.0,
"SalePrice": null
}
],
"Currency": null,
"SaleStart": null,
"SaleEnd": null,
"IsOnSale": false,
"xp": null
},
"ID": "SHIRT",
"Name": "Cotton T-Shirt",
"Description": "A plain white, cotton shirt for everyday use.",
"QuantityMultiplier": 1,
"ShipWeight": null,
"ShipHeight": null,
"ShipWidth": null,
"ShipLength": null,
"Active": true,
"SpecCount": 0,
"VariantCount": 0,
"ShipFromAddressID": null,
"Inventory": null,
"DefaultSupplierID": null,
"AllSuppliersCanSell": false,
"Returnable": false,
"xp": null
}
]
}

Related

How to create complex-rules for modifier of product in bigcommerce

I am new in bigcommerce and type to added complex-rules for Modifier of product. below provide the URL of API URL and JSON.
every time give error "The rule must contain multiple modifier conditions with unique modifier ids or a variant condition and modifier condition"
https://api.bigcommerce.com/stores/{$$.env.store_hash}/v3/catalog/products/{product_id}/complex-rules
Please help where I wrong in send Complex Rule request JSON.
Modifier:
{
"data": {
"config": [],
"display_name": "Donation",
"id": 188,
"name": "Donation1645178599-166",
"option_values": [
{
"adjusters": {
"image_url": "",
"price": null,
"purchasing_disabled": {
"message": "",
"status": false
},
"weight": null
},
"id": 352,
"is_default": true,
"label": "$5 Donation",
"option_id": 188,
"sort_order": 0,
"value_data": null
},
{
"adjusters": {
"image_url": "",
"price": null,
"purchasing_disabled": {
"message": "",
"status": false
},
"weight": null
},
"id": 353,
"is_default": false,
"label": "$10 Donation",
"option_id": 188,
"sort_order": 0,
"value_data": null
}
],
"product_id": 166,
"required": false,
"sort_order": 0,
"type": "dropdown"
},
"meta": {}
}
Complex Rule request JSON:
{
"product_id": 166,
"sort_order": 0,
"enabled": true,
"stop": false,
"purchasing_disabled": false,
"purchasing_hidden": false,
"price_adjuster": {
"adjuster": "relative",
"adjuster_value": 6
},
"weight_adjuster": {
"adjuster": "relative",
"adjuster_value": 6
},
"conditions": [
{
"id": 5,
"rule_id": 5,
"modifier_id": 189,
"modifier_value_id": 352
}
]
}
Error output:
{
"status": 422,
"title": "The rule must contain multiple modifier conditions with unique modifier ids or a variant condition and modifier condition",
"type": "https://developer.bigcommerce.com/api-docs/getting-started/api-status-codes"
}

Azure DevOps API release definition error

I am creating azure-devops release pipeline with API, but getting error. I have validated the json as well and is correct from https://jsonlint.com/ Any help would be really appreciated
I have followed this issue as well and retention policy is correctly passed
Azure DevOps API release definition
error: "message": "VS402982: A retention policy is not set for the stage β€˜Test-New-2’. Retention policies at the release pipeline level are deprecated. Use a retention policy at the stage level
POST https://vsrm.dev.azure.com/{{organization}}/{{project}}/_apis/release/definitions?api-version=6.0
json body:
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
Yes, it should be the syntax issue, to create a release definition, you could refer to this sample.
Reruest URL:
POST https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/definitions?api-version=6.0
Request Body:
{
"source": "undefined",
"revision": 1,
"description": null,
"createdBy": null,
"createdOn": "0001-01-01T00:00:00",
"modifiedBy": null,
"modifiedOn": "0001-01-01T00:00:00",
"isDeleted": false,
"variables": {},
"variableGroups": [],
"environments": [
{
"id": 0,
"name": "PROD",
"variables": {},
"variableGroups": [],
"preDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": false,
"isNotificationOn": false,
"approver": {
"displayName": null,
"id": "aeb95c63-4fac-4948-84ce-711b0a9dda97"
},
"id": 0
}
]
},
"postDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false,
"id": 0
}
]
},
"deployPhases": [
{
"deploymentInput": {
"parallelExecution": {
"parallelExecutionType": "none"
},
"skipArtifactsDownload": false,
"artifactsDownloadInput": {},
"queueId": 15,
"demands": [],
"enableAccessToken": false,
"timeoutInMinutes": 0,
"jobCancelTimeoutInMinutes": 1,
"condition": "succeeded()",
"overrideInputs": {}
},
"rank": 1,
"phaseType": "agentBasedDeployment",
"name": "Run on agent",
"workflowTasks": []
}
],
"environmentOptions": {
"emailNotificationType": "OnlyOnFailure",
"emailRecipients": "release.environment.owner;release.creator",
"skipArtifactsDownload": false,
"timeoutInMinutes": 0,
"enableAccessToken": false,
"publishDeploymentStatus": false,
"badgeEnabled": false,
"autoLinkWorkItems": false,
"pullRequestDeploymentEnabled": false
},
"demands": [],
"conditions": [],
"executionPolicy": {
"concurrencyCount": 0,
"queueDepthCount": 0
},
"schedules": [],
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
"properties": {},
"preDeploymentGates": {
"id": 0,
"gatesOptions": null,
"gates": []
},
"postDeploymentGates": {
"id": 0,
"gatesOptions": null,
"gates": []
},
"environmentTriggers": []
}
],
"artifacts": [],
"triggers": [],
"releaseNameFormat": null,
"tags": [],
"properties": {},
"id": 0,
"name": "Fabrikam-web",
"projectReference": null,
"_links": {}
}
I test it on my side, it works for me.

How add product with pick_list modifier to cart

What is the appropriate syntax to add a sku with picklist modifiers to cart?
https://developer.bigcommerce.com/api-reference/cart-checkout/storefront-cart-api/cart/addcartlineitem
Assuming this is my product
GET https://api.bigcommerce.com/stores/:store-hash/v3/catalog/products?include=modifiers,variants&id:in=237
{
"data": [
{
"id": 237,
"name": "Awesome Bundle Sku",
"type": "physical",
"sku": "BUNDLE1",
"description": "",
"weight": 1,
"width": 1,
"depth": 1,
"height": 1,
"price": 99,
"cost_price": 0,
"retail_price": 0,
"sale_price": 0,
"map_price": 0,
"tax_class_id": 0,
"product_tax_code": "",
"calculated_price": 99,
"categories": [
50
],
"brand_id": 0,
"option_set_id": 25,
"option_set_display": "right",
"inventory_level": 0,
"inventory_warning_level": 0,
"inventory_tracking": "none",
"reviews_rating_sum": 0,
"reviews_count": 0,
"total_sold": 0,
"fixed_cost_shipping_price": 0,
"is_free_shipping": false,
"is_visible": false,
"is_featured": false,
"related_products": [
-1
],
"warranty": "",
"bin_picking_number": "",
"layout_file": "product.html",
"upc": "",
"mpn": "",
"gtin": "",
"search_keywords": "",
"availability": "available",
"availability_description": "",
"gift_wrapping_options_type": "any",
"gift_wrapping_options_list": [],
"sort_order": 500,
"condition": "New",
"is_condition_shown": false,
"order_quantity_minimum": 0,
"order_quantity_maximum": 0,
"page_title": "",
"meta_keywords": [],
"meta_description": "",
"date_created": "2019-05-29T19:16:08+00:00",
"date_modified": "2019-08-24T19:28:45+00:00",
"view_count": 0,
"preorder_release_date": null,
"preorder_message": "",
"is_preorder_only": false,
"is_price_hidden": false,
"price_hidden_label": "",
"custom_url": {
"url": "/bundle1/",
"is_customized": false
},
"base_variant_id": 202,
"open_graph_type": "product",
"open_graph_title": "",
"open_graph_description": "",
"open_graph_use_meta_description": true,
"open_graph_use_product_name": true,
"open_graph_use_image": true,
"variants": [
{
"id": 202,
"product_id": 237,
"sku": "BUNDLE1",
"sku_id": null,
"price": 99,
"calculated_price": 99,
"sale_price": 0,
"retail_price": 0,
"map_price": 0,
"weight": 1,
"width": 1,
"height": 1,
"depth": 1,
"is_free_shipping": false,
"fixed_cost_shipping_price": 0,
"calculated_weight": 1,
"purchasing_disabled": false,
"purchasing_disabled_message": "",
"image_url": "",
"cost_price": 0,
"upc": "",
"mpn": "",
"gtin": "",
"inventory_level": 0,
"inventory_warning_level": 0,
"bin_picking_number": "",
"option_values": []
}
],
"modifiers": [
{
"id": 140,
"product_id": 237,
"name": "53701567688198-237",
"display_name": "5370",
"type": "product_list",
"required": true,
"sort_order": 1,
"config": {
"product_list_adjusts_inventory": false,
"product_list_adjusts_pricing": false,
"product_list_shipping_calc": "none"
},
"option_values": [
{
"id": 127,
"option_id": 140,
"label": "COMPONENT1",
"sort_order": 0,
"value_data": {
"product_id": 136
},
"is_default": true,
"adjusters": {
"price": null,
"weight": null,
"image_url": "",
"purchasing_disabled": {
"status": false,
"message": ""
}
}
}
]
}
]
}
],
"meta": {
"pagination": {
"total": 1,
"count": 1,
"per_page": 250,
"current_page": 1,
"total_pages": 1,
"links": {
"current": "?limit=250&include=modifiers%2Cvariants&id%3Ain=237&page=1"
},
"too_many": false
}
}
}
POST https://api.bigcommerce.com/stores/:store-hash/v3/carts/:cart-id/items
{
"line_items": [
{
"product_id": 237,
"quantity": 1,
"option_selections": [
{
"option_id": 140,
"option_value": 127
}
]
}
]
}

Parsing Twitter Information with jq ("text": null)

I am trying to do some Twitter-analysis via Twurl and extract some information via jq.
I firstly get some tweets via twurl with the command
twurl /1.1/users/search.json?q=judo
Then i used the following line to structure the outpot with jq:
twurl /1.1/users/search.json?q=judo | jq
i get something like this:
[
{
"id": 173752759,
"id_str": "173752759",
"name": "#JudoWorlds πŸ₯‹",
"screen_name": "Judo",
"location": "Worldwide",
"description": "The Official Twitter Account of the International Judo Federation πŸ₯‹",
"url": "https:.....",
"entities": {
"url": {
"urls": [
{
"url": "https://......",
"expanded_url": "https://www.ijf.org/news/show/5-must-see-preliminary-round-clashes-2",
"display_url": "ijf.org/news/show/5-mu…",
"indices": [
0,
23
]
}
]
},
"description": {
"urls": []
}
},
"protected": false,
"followers_count": 59854,
"friends_count": 847,
"listed_count": 529,
"created_at": "Mon Aug 02 07:55:15 +0000 2010",
"favourites_count": 7074,
"utc_offset": null,
"time_zone": null,
"geo_enabled": true,
"verified": true,
"statuses_count": 16532,
"lang": null,
"status": {
"created_at": "Fri Aug 30 08:27:10 +0000 2019",
"id": 1167353053282013200,
"id_str": "1167353053282013184",
"text": "#JudoWorlds The Alternative Promo \n\n#NeilAdamsJudo https://.....",
"truncated": false,
"entities": {
"hashtags": [
{
"text": "JudoWorlds",
"indices": [
0,
11
]
}
],
"symbols": [],
"user_mentions": [
{
"screen_name": "NeilAdamsJudo",
"name": "Neil Adams MBE",
"id": 40488733,
"id_str": "40488733",
"indices": [
36,
50
]
}
],
"urls": [],
"media": [
{
"id": 1167352899267002400,
"id_str": "1167352899267002369",
"indices": [
51,
74
],
"media_url": "http://pbs.twimg.com/ext_tw_video_thumb/1167352899267002369/pu/img/6yD1r7uaPV7p3y6a.jpg",
"media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/1167352899267002369/pu/img/6yD1r7uaPV7p3y6a.jpg",
"url": "https://......",
"display_url": "pic.twitter.com/0RlLbKLkN8",
"expanded_url": "https://twitter.com/Judo/status/1167353053282013184/video/1",
"type": "photo",
"sizes": {
"thumb": {
"w": 150,
"h": 150,
"resize": "crop"
},
"medium": {
"w": 1200,
"h": 675,
"resize": "fit"
},
"small": {
"w": 680,
"h": 383,
"resize": "fit"
},
"large": {
"w": 1280,
"h": 720,
"resize": "fit"
}
}
}
]
},
"extended_entities": {
"media": [
{
"id": 1167352899267002400,
"id_str": "1167352899267002369",
"indices": [
51,
74
],
"media_url": "http://pbs.twimg.com/ext_tw_video_thumb/1167352899267002369/pu/img/6yD1r7uaPV7p3y6a.jpg",
"media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/1167352899267002369/pu/img/6yD1r7uaPV7p3y6a.jpg",
"url": "https://.....",
"display_url": "pic.twitter.com/0RlLbKLkN8",
"expanded_url": "https://twitter.com/Judo/status/1167353053282013184/video/1",
"type": "video",
"sizes": {
"thumb": {
"w": 150,
"h": 150,
"resize": "crop"
},
"medium": {
"w": 1200,
"h": 675,
"resize": "fit"
},
"small": {
"w": 680,
"h": 383,
"resize": "fit"
},
"large": {
"w": 1280,
"h": 720,
"resize": "fit"
}
},
"video_info": {
"aspect_ratio": [
16,
9
],
"duration_millis": 48800,
"variants": [
{
"bitrate": 256000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/ext_tw_video/1167352899267002369/pu/vid/480x270/v4nkTg6qs9rpLq8M.mp4?tag=10"
},
{
"content_type": "application/x-mpegURL",
"url": "https://video.twimg.com/ext_tw_video/1167352899267002369/pu/pl/SQN57QxQFYcKWV7l.m3u8?tag=10"
},
{
"bitrate": 2176000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/ext_tw_video/1167352899267002369/pu/vid/1280x720/8cyNocB_8CRjwVCI.mp4?tag=10"
},
{
"bitrate": 832000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/ext_tw_video/1167352899267002369/pu/vid/640x360/uy2U7D_AEmbLdqEK.mp4?tag=10"
}
]
},
"additional_media_info": {
"monetizable": false
}
}
]
},
"source": "Twitter for Android",
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"is_quote_status": false,
"retweet_count": 4,
"favorite_count": 17,
"favorited": false,
"retweeted": false,
"possibly_sensitive": false,
"lang": "en"
},
"contributors_enabled": false,
"is_translator": false,
"is_translation_enabled": false,
"profile_background_color": "0099CC",
"profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",
"profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",
"profile_background_tile": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/1057928008797970433/O3l2sKj0_normal.jpg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/1057928008797970433/O3l2sKj0_normal.jpg",
"profile_banner_url": "https://pbs.twimg.com/profile_banners/173752759/1565853008",
"profile_link_color": "0C3C42",
"profile_sidebar_border_color": "8F320A",
"profile_sidebar_fill_color": "F2CF41",
"profile_text_color": "000000",
"profile_use_background_image": true,
"has_extended_profile": false,
"default_profile": false,
"default_profile_image": false,
"following": false,
"follow_request_sent": false,
"notifications": false,
"translator_type": "none"
},
Because i am only interested in certain informations i tried to get the name and the text of the tweet with the following command:
twurl /1.1/users/search.json?q=judo | jq ".[] | { name: .name, text: .text }"
and i get this:
{
"name": "#JudoWorlds πŸ₯‹",
"text": null
}
{
"name": "#WeAreGBJudo",
"text": null
}
{
"name": "CBJ",
"text": null
}
{
"name": "Santos Futebol Clube",
"text": null
}
{
"name": "Marius Vizer",
"text": null
}
{
"name": "FF Judo",
"text": null
}
{
"name": "Santos FC πŸ‡Ί πŸ‡Έ πŸ‡¬ πŸ‡§ ",
"text": null
}
{
"name": "USA Judo",
"text": null
}
{
"name": "ε…¨ζ—₯ζœ¬ζŸ”ι“ι€£η›Ÿ -ゴジラジャパン-",
"text": null
}
{
"name": "Vila Belmiro",
"text": null
}
{
"name": "Deutscher Judo-Bund",
"text": null
}
{
"name": "Bruno Secco",
"text": null
}
{
"name": "Bobby Judo",
"text": null
}
{
"name": "African Judo Union",
"text": null
}
{
"name": "JudoInside.com",
"text": null
}
{
"name": "For competitive judo",
"text": null
}
{
"name": "Judo Canada",
"text": null
}
{
"name": "Neil Adams MBE",
"text": null
}
{
"name": "Sophie Cox",
"text": null
}
{
"name": "Galatasaray Judo",
"text": null
}
Why is this and how can i fix it?
I tried other commands like :
twurl /1.1/search/tweets.json?q=afd | jq ".[] | { name: .name, text: .text }"
but got the error
jq: error (at <stdin>:0): Cannot index array with string "name"
If you need nested 'text' value from 'status' field you should use:
.[] | { name: .name, text: .status.text }
Or shorter version:
.[] | { name, text: .status.text }

Cart API: cart.data.data.cart_amount is not calculated correctly.... I think

added a product to cart using API price was $29
GET /v3/carts/cartId saw cart_amount was correct
changed product price to $100
GET /v3/carts/cartId saw cart_amount was wrong β€” it did not see that the product price had changed.
Am i doing something wrong. Do you need more info to help me?
bc.add_to_cart = (data,next) => {
let payload = {
line_items: data.line_items,
option_selections: data.option_selections,
gift_certificatesL: null
}
return bc_v3.post(`/carts/${data.cartId}/items`, payload).then(data => {
return data; // data only show initial product cost
}).catch(next);
};
EDIT
below i am posting the results of GET carts/id u will see that the lineItem (id: 125) shows the original price, 29.95. Immediately after getting the cart I did a request to GET /catalog/products/125 β€” that one shows the updated price.
GET: carts/${cartId}
{
"data": {
"id": "15219c6d-51a8-4267-a38c-29fe62a49182",
"customer_id": 0,
"email": "",
"currency": {
"code": "USD"
},
"tax_included": false,
"base_amount": 409.7,
"discount_amount": 0,
"cart_amount": 409.7,
"coupons": [],
"line_items": {
"physical_items": [
{
"id": "d755137f-b09c-4a02-9da6-cab8da1ae332",
"parent_id": null,
"variant_id": 89,
"product_id": 124,
"sku": "test_config",
"name": "Test Configurable item",
"url": "http://fornida.mybigcommerce.com/test-configurable-item/",
"quantity": 2,
"taxable": true,
"image_url": "https://cdn7.bigcommerce.com/s-2bihpr2wvz/products/124/images/389/overview-3-lg-c__55453.1534430965.220.290.jpg?c=2",
"discounts": [],
"coupons": [],
"discount_amount": 0,
"coupon_amount": 0,
"list_price": 115,
"sale_price": 115,
"extended_list_price": 230,
"extended_sale_price": 230,
"is_require_shipping": true
},
{
"id": "eb5695d6-85e5-4b58-891b-a4bd8b48c56e",
"parent_id": null,
"variant_id": 90,
"product_id": 125,
"sku": "test_compt_1",
"name": "test component 1",
"url": "http://fornida.mybigcommerce.com/test-component-1/",
"quantity": 6,
"taxable": true,
"image_url": "https://cdn7.bigcommerce.com/r-03b8fdf5d1037c0feebbcedfd701c709422a962e/themes/ClassicNext/images/ProductDefault.gif",
"discounts": [],
"coupons": [],
"discount_amount": 0,
"coupon_amount": 0,
"list_price": 29.95,
"sale_price": 29.95,
"extended_list_price": 179.7,
"extended_sale_price": 179.7,
"is_require_shipping": true
}
],
"digital_items": [],
"gift_certificates": []
},
"created_time": "2018-08-23T15:41:10+00:00",
"updated_time": "2018-08-23T18:57:55+00:00"
},
"meta": {}
}
GET /catalog/products/125
{
"data": {
"id": 125,
"name": "test component 1",
"type": "physical",
"sku": "test_compt_1",
"description": "<p>Type a description for this product here...</p>",
"weight": 2,
"width": 0,
"depth": 0,
"height": 0,
"price": 125,
"cost_price": 0,
"retail_price": 0,
"sale_price": 0,
"map_price": 0,
"tax_class_id": 0,
"product_tax_code": "",
"calculated_price": 125,
"categories": [
23,
18
],
"brand_id": 0,
"option_set_id": 38,
"option_set_display": "right",
"inventory_level": 0,
"inventory_warning_level": 0,
"inventory_tracking": "none",
"reviews_rating_sum": 0,
"reviews_count": 0,
"total_sold": 0,
"fixed_cost_shipping_price": 0,
"is_free_shipping": false,
"is_visible": true,
"is_featured": false,
"related_products": [
-1
],
"warranty": "",
"bin_picking_number": "",
"layout_file": "product.html",
"upc": "",
"mpn": "",
"gtin": "",
"search_keywords": "",
"availability": "available",
"availability_description": "",
"gift_wrapping_options_type": "any",
"gift_wrapping_options_list": [],
"sort_order": 0,
"condition": "New",
"is_condition_shown": false,
"order_quantity_minimum": 0,
"order_quantity_maximum": 0,
"page_title": "",
"meta_keywords": [],
"meta_description": "",
"date_created": "2018-08-15T13:46:57+00:00",
"date_modified": "2018-08-23T18:22:52+00:00",
"view_count": 7,
"preorder_release_date": null,
"preorder_message": "",
"is_preorder_only": false,
"is_price_hidden": false,
"price_hidden_label": "",
"custom_url": {
"url": "/test-component-1/",
"is_customized": false
},
"base_variant_id": 90,
"open_graph_type": "product",
"open_graph_title": "",
"open_graph_description": "",
"open_graph_use_meta_description": true,
"open_graph_use_product_name": true,
"open_graph_use_image": true
},
"meta": {}
}
Updating the price of an item in the control panel or using the API will not change the price in an existing cart. If you create a new cart then the price will reflect the changes that were made.
The original cart where line_item is $25 dollars and tax is included as well to give a cart_amount of 29.12
{
"data": {
"id": "3a4c8e16-e279-4c30-83df-0010f6d54fba",
"customer_id": 0,
"email": "",
"currency": {
"code": "USD"
},
"tax_included": false,
"base_amount": 25,
"discount_amount": 0,
"cart_amount": 29.12,
"coupons": [],
"line_items": {
"physical_items": [
{
"id": "1e08875e-bf6f-4f1f-b8ba-b2e3cee10394",
"parent_id": null,
"variant_id": 363,
"product_id": 192,
"sku": "",
"name": "Smith Journal 13",
"url": "http://{store_hash}}.mybigcommerce.com/all/smith-journal-13/",
"quantity": 1,
"taxable": true,
"image_url": "https://cdn8.bigcommerce.com/s-{{store_hash}}/products/192/images/480/smithjournal1_1024x1024__85081__38998.1534344545.330.500.jpg?c=2",
"discounts": [],
"coupons": [],
"discount_amount": 0,
"coupon_amount": 0,
"list_price": 25,
"sale_price": 25,
"extended_list_price": 25,
"extended_sale_price": 25,
"is_require_shipping": true
}
],
"digital_items": [],
"gift_certificates": []
},
"created_time": "2018-08-24T14:41:17+00:00",
"updated_time": "2018-08-24T14:41:17+00:00"
},
"meta": {}
}
Update the line_item price /{store_hash}/v3/carts/{cartId}/items/{itemId}
{
"line_item":
{
"list_price": 30,
"quantity": 1,
"product_id": 192
}
}
Response - base_amount is now 30, and cart_amount is also updated to 34.96. This only changes the price for the cart and not the product
{
"data": {
"id": "3a4c8e16-e279-4c30-83df-0010f6d54fba",
"customer_id": 0,
"email": "",
"currency": {
"code": "USD"
},
"tax_included": false,
"base_amount": 30,
"discount_amount": 0,
"cart_amount": 34.96,
"coupons": [],
"line_items": {
"physical_items": [
{
"id": "1e08875e-bf6f-4f1f-b8ba-b2e3cee10394",
"parent_id": null,
"variant_id": 363,
"product_id": 192,
"sku": "",
"name": "Smith Journal 13",
"url": "http://{store_hash}.mybigcommerce.com/all/smith-journal-13/",
"quantity": 1,
"taxable": true,
"image_url": "https://cdn8.bigcommerce.com/s-{store_hash}/products/192/images/480/smithjournal1_1024x1024__85081__38998.1534344545.330.500.jpg?c=2",
"discounts": [],
"coupons": [],
"discount_amount": 0,
"coupon_amount": 0,
"list_price": 30,
"sale_price": 30,
"extended_list_price": 30,
"extended_sale_price": 30,
"is_require_shipping": true
}
],
"digital_items": [],
"gift_certificates": []
},
"created_time": "2018-08-24T14:41:17+00:00",
"updated_time": "2018-08-24T14:41:17+00:00"
},
"meta": {}
}