useRemoteQueryStep - Helper Steps API Reference

This documentation provides a reference to the useRemoteQueryStep step. It belongs to the @medusajs/medusa/core-flows package.

This step fetches data across modules using the remote query.

Learn more in the Remote Query documentation.

NoteThis step is deprecated. Use useQueryGraphStep instead.

Example#

To retrieve a list of records of a data model:

Code
1const products = useRemoteQueryStep({2  entry_point: "product",3  fields: [4    "*",5    "variants.*"6  ]7})

To retrieve a single item instead of a an array:

Code
1const product = useRemoteQueryStep({2  entry_point: "product",3  fields: [4    "*",5    "variants.*"6  ],7  variables: {8    filters: {9      id: "123"10    }11  },12  list: false13})

To throw an error if a record isn't found matching the specified ID:

Code
1const product = useRemoteQueryStep({2  entry_point: "product",3  fields: [4    "*",5    "variants.*"6  ],7  variables: {8    filters: {9      id: "123"10    }11  },12  list: false,13  throw_if_key_not_found: true14})

Input#

EntryStepInput | ServiceStepInputEntryStepInput | ServiceStepInput
EntryStepInput | ServiceStepInputEntryStepInput | ServiceStepInput
Was this page helpful?