while adding product to cart problem with custom options - magento graphql
prabhakaran777 opened this issue · 1 comments
Preconditions (*)
i have simple product with custom options
query fetch{
products (
filter: {
sku: { eq: "Custom option product 1" }
}
pageSize: 3
currentPage:1
)
{
total_count
items {
new_product_attribute
name
sku
thumbnail{
url
}
image{
url
}
media_gallery_entries{
file
video_content{
video_url
}
}
...on CustomizableProductInterface{
__typename
options{
required
__typename
... on CustomizableDropDownOption{
title
value{
price_type
option_type_id
title
price
sku
}
}
}
}
special_price
price {
regularPrice {
amount {
value
currency
}
}
}
}
page_info {
page_size
current_page
}
}
}
Response :
{
"data": {
"products": {
"total_count": 1,
"items": [
{
"new_product_attribute": "vale",
"name": "Custom option product 1",
"sku": "Custom option product 1",
"thumbnail": {
"url": "https://magtest.webc.in/pub/static/version1575352932/graphql/_view/en_US/Magento_Catalog/images/product/placeholder/thumbnail.jpg"
},
"image": {
"url": "https://magtest.webc.in/pub/static/version1575352932/graphql/_view/en_US/Magento_Catalog/images/product/placeholder/image.jpg"
},
"media_gallery_entries": [],
"__typename": "SimpleProduct",
"options": [
{
"required": true,
"__typename": "CustomizableDropDownOption",
"title": "Options",
"value": [
{
"price_type": "FIXED",
"option_type_id": 3,
"title": "First ",
"price": 10,
"sku": null
},
{
"price_type": "PERCENT",
"option_type_id": 4,
"title": "Second",
"price": 10,
"sku": null
}
]
}
],
"special_price": null,
"price": {
"regularPrice": {
"amount": {
"value": 130,
"currency": "USD"
}
}
}
}
],
"page_info": {
"page_size": 3,
"current_page": 1
}
}
}
i tried with
mutation {
addSimpleProductsToCart(
input: {
cart_id: "3NCZb9BbUfrPjMbfXxYzWuPetbuDOo96"
cart_items: [
{
data: {
quantity: 1
sku: "Custom option product 1"
}
customizable_options:[
{
id:4
value_string:"Second"
}
]
}
]
}
) {
cart {
items {
id
product {
sku
stock_status
}
quantity
}
}
}
}
Expected result (*)
- Need to add the product to cart
Actual result (*)
{
"errors": [
{
"message": "The product's required option(s) weren't entered. Make sure the options are entered and try again.",
"category": "graphql-input",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"addSimpleProductsToCart"
]
}
],
"data": {
"addSimpleProductsToCart": null
}
}
found solution
given wrong values