Cannot create product modifiers

modifiers
reactjs
javascript

#1

While I attempted to create product modifiers using :
https://api.moltin.com/v2/variations/{variationId}/options/{optionId}/modifiers

and sending body as

  "data": {
    "type": "modifier",
    "id": {ProductId},
    "modifier_type": "price_increment",
    "value": [
    	{
    		"currency": "INR",
    		"amount": 200,
    		"included_tax": true
    	},
    	{
    		"currency": "USD",
    		"amount": 2,
    		"included_tax": true
    	}]
  }
}

as application/json

It is giving error as

{
    "errors": [
        {
            "status": 500,
            "title": "Internal Server Error",
            "detail": "There was an internal server error, you can report with your request id.",
            "request_id": "a6aeaee8298bc5c3"
        }
    ]
}

What is the problem from my end?


#2

Hi,

Would you be able to provide a product ID, variation ID and option ID where this is happening please so we can attempt to replicate?

Thanks in advance!


#3

variationId: 934a018e-9980-4c9e-af24-774d38737785,
optionId: 3a475da6-f4c6-4411-b106-572daa42310e,
productId: eaf7cb93-b813-47ef-906b-39b520d9e716


#4

When creating a modifier do not supply an ID

https://docs.moltin.com/#product-modifiers unfortunately does indicate that it should - this is in error.

You most certainly would not be using any ProductID for this purpose.

I will ticket the updates required in our docs.

Hope this helps and if you have any further issues do not hesitate to post back on this thread if needed.


#5

@culeneji-3754yopmai apologies for the confusion here. As previously noted, the id field is not required in the request body. The error you are seeing however is due to two typos in your request. You should be using includes_tax instead of included_tax.

We’ll get the validation updated for this endpoint so that the issue is more obvious in the future.

Thanks for bringing this up!
James


#6

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.