Hello Magento Friends,

In today’s Magento blog, I will explain How to Get System Configuration Value using GraphQL API in Magento 2.

Magento 2 provides a robust GraphQL API that allows developers to access and manipulate data efficiently. In this guide, we will explore how to retrieve system configuration values using the GraphQL API in Magento 2.

Steps to Get System Configuration Value using GraphQL API in Magento 2:

Step 1: First, we need to create a system.xml file inside the extension at the following path.

app\code\Vendor\Extension\etc\adminhtml\

Then add the code as follows

Step 2: After that, we need to create a di.xml file inside the extension at the following path.

app\code\Vendor\Extension\etc\graphql\

Now add the below-mentioned code

Here, the path of the field will be: section/group/field

Step 3: After that, we need to create a schema.graphqls file inside the extension at the following path.

app\code\Vendor\Extension\etc\

Now add the below-given code snippet

Step 4: Once all files are created in your Magento, you need to run Magento upgrade, compile and deploy commands as follows.

Step 5: Postman to run the below query to get configuration value on storeconfig response.

Output:

admin configuration

GraphQL response:

graphql response

Conclusion:

Using the steps outlined above, you can easily retrieve system configuration values using the GraphQL API in Magento 2. By leveraging the power of the Magento 2 GraphQL API, you can efficiently access and manage system configuration data in your Magento 2 store.

Also learn How to Submit Contact Us Data using GraphQL API in Magento 2.

Share the tutorial with your friends and stay updated for more such Magento 2 tutorials.

Happy Coding!

Click to rate this post!
[Total: 0 Average: 0]