Mimic fulfillment_service field functionality on /variant REST Admin API in GraphQL

Hi,

How do we achieve the functionality of fulfillment_service field that is available on /variant REST admin APIs in GraphQL? In REST API we could just provide the fulfillment service handle and REST API would magically add it?

I created a simple fulfillment service in my dev store and it appears in the locations drop down on variants. And when I try to run the mutation inventoryActivate using the variant’s inventory item id and the fulfillment service’s location id, I get the below error -
The product couldn’t be stocked at <fulfillment_service_handle> because the inventory is managed by <fulfillment_service_handle>.

Hi Prabhuling,

I believe you’ll need to use the fulfillmentServiceCreate mutation which should automatically create a location associated with the fulfillment service.

Once the fulfillment service is created, you can use the inventoryActivate mutation to activate an inventory item at the location associated with the fulfillment service. This is similar to setting the fulfillment service handle in the REST API.

Try out this flow and let us know if it works for your use case.

Hi,

The fulfillment-service is already created from the UI : Settings → Shipping and delivery → Custom order fulfillment → Add fulfillment service. E.g, ‘test_fulfillment’

With REST api, I can just send this ‘test_fulfillment’ in the variant payload and ‘test_fulfillment’ is reflected in the Inventory Drop Down on the variant (similar to just selecting ‘test_fulfillment’ from the drop down on UI)

Want to be able to do the same using GraphQL on the already created fulfillment service.
PS: Creating fulfillment service from UI also creates seems to create a location (seen in API response, but not on UI)