{"id":69129,"date":"2016-12-23T08:17:12","date_gmt":"2016-12-23T08:17:12","guid":{"rendered":"http:\/\/webkul.com\/blog\/?p=69129"},"modified":"2025-12-11T09:02:38","modified_gmt":"2025-12-11T09:02:38","slug":"create-custom-js-window-configproviders-magento-2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/","title":{"rendered":"How to create custom Js window configProviders in Magento 2"},"content":{"rendered":"\n<p>We\u2019ll explore how to Create Custom JS Window ConfigProviders in Magento 2 and learn the simplest way to extend JavaScript configuration data.<\/p>\n\n\n\n<p>In Magento 2 all required data saved in window.checkoutConfig<br>so at the time of checkout it can be fetched by js models easily.<br>We can also save our custom required data in window.checkoutConfig providers by using <strong>frontend\/di.xml<\/strong><\/p>\n\n\n\n<p>Here is an image, see how data stored in window.checkoutConfig.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"975\" height=\"411\" src=\"http:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_13-1.png\" alt=\"\" class=\"wp-image-69135\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_13-1.png 975w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_13-1-250x105.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_13-1-300x126.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_13-1-768x324.png 768w\" sizes=\"(max-width: 975px) 100vw, 975px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>So, now lets create our own Config Provider, we can use it in our Module as well as in dependent Modules.<\/p>\n\n\n\n<p><strong>1.<\/strong> Create di.xml file <strong>Webkul\/Knockout\/etc\/frontend\/di.xml<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n&lt;!-- \n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_Knockout\n * @author    Webkul\n * @copyright Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\n --&gt;\n&lt;config xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:ObjectManager\/etc\/config.xsd&quot;&gt;\n    &lt;type name=&quot;Webkul\\Knockout\\Model\\CustomConfigProvider&quot;&gt;\n        &lt;arguments&gt;\n            &lt;argument name=&quot;configProviders&quot; xsi:type=&quot;array&quot;&gt;\n                &lt;item name=&quot;custom_config_provider&quot; xsi:type=&quot;object&quot;&gt;Webkul\\Knockout\\Model\\DefaultConfigProvider&lt;\/item&gt;\n            &lt;\/argument&gt;\n        &lt;\/arguments&gt;\n    &lt;\/type&gt;\n&lt;\/config&gt;<\/pre>\n\n\n\n<p><strong>2.<\/strong> Now create Config Provider Interface <strong>Webkul\/Knockout\/Model\/ConfigProviderInterface.php<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_Knockout\n * @author    Webkul\n * @copyright Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Webkul\\Knockout\\Model;\n\n\/**\n * Interface ConfigProviderInterface\n * @api\n *\/\ninterface ConfigProviderInterface\n{\n\n    \/**\n     * Retrieve assoc array of checkout configuration\n     *\n     * @return array\n     *\/\n    public function getConfig();\n}<\/pre>\n\n\n\n<p><strong>3.<\/strong> Create <strong>Webkul\\Knockout\\Model\\CustomConfigProvider.php<\/strong> which will be used to<br>collect all Child Config Providers data and merge them.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_Knockout\n * @author    Webkul\n * @copyright Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Webkul\\Knockout\\Model;\n\nclass CustomConfigProvider implements ConfigProviderInterface\n{\n    \/**\n     * @var ConfigProviderInterface&#091;]\n     *\/\n    private $configProviders;\n\n    \/**\n     * @param ConfigProviderInterface&#091;] $configProviders\n     *\/\n    public function __construct(\n        array $configProviders\n    ) {\n        $this-&gt;configProviders = $configProviders;\n    }\n\n    \/**\n     * @inheritdoc\n     *\/\n    public function getConfig()\n    {\n        $config = &#091;];\n        foreach ($this-&gt;configProviders as $configProvider) {\n            $config = array_merge_recursive($config, $configProvider-&gt;getConfig());\n        }\n        return $config;\n    }\n}<\/pre>\n\n\n\n<p>Now see in the di.xml file, we have passed a DefaultConfigProvider as an argument for CustomConfigProvider.<\/p>\n\n\n\n<p><strong>4.<\/strong> Finally Create <strong>Webkul\/Knockout\/Model\/DefaultConfigProvider.php<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_Knockout\n * @author    Webkul\n * @copyright Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Webkul\\Knockout\\Model;\n\nclass DefaultConfigProvider implements ConfigProviderInterface\n{\n    \/**\n     * @inheritdoc\n     *\/\n    public function getConfig()\n    {\n        $config = &#091;\n            &#039;name&#039; =&gt; &#039;John Doe&#039;,\n            &#039;Email&#039; =&gt; &#039;john@webkul.com&#039;,\n            &#039;DOB&#039; =&gt; &#039;08\/05\/1990&#039;,\n        ];\n\n        return $config;\n    }\n}<\/pre>\n\n\n\n<p><strong>Example: how to use our custom js provider.<\/strong><\/p>\n\n\n\n<p>I am going to call our custom phtml file on customer account, you call according to your requirement.<\/p>\n\n\n\n<p><strong>a)<\/strong> Create <strong>Webkul\/Knockout\/view\/frontend\/layout\/knockout_account_index.xml<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n\n&lt;page xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd&quot;&gt;\n    &lt;update handle=&quot;customer_account&quot;\/&gt;\n    &lt;body&gt;\n        &lt;referenceContainer name=&quot;content&quot;&gt;\n            &lt;block class=&quot;Webkul\\Knockout\\Block\\Account&quot; name=&quot;customer_account_knockout_test&quot; template=&quot;Webkul_Knockout::account\/knockout.phtml&quot; cacheable=&quot;false&quot;&gt;\n                &lt;arguments&gt;\n                    &lt;argument name=&quot;jsLayout&quot; xsi:type=&quot;array&quot;&gt;\n                        &lt;item name=&quot;components&quot; xsi:type=&quot;array&quot;&gt;\n                            &lt;item name=&quot;customcomponent&quot; xsi:type=&quot;array&quot;&gt;\n                                &lt;item name=&quot;component&quot; xsi:type=&quot;string&quot;&gt;Webkul_Knockout\/js\/custom-component&lt;\/item&gt;\n                            &lt;\/item&gt;\n                        &lt;\/item&gt;\n                    &lt;\/argument&gt;\n                &lt;\/arguments&gt;\n            &lt;\/block&gt;\n        &lt;\/referenceContainer&gt;\n    &lt;\/body&gt;\n&lt;\/page&gt;<\/pre>\n\n\n\n<p>In this xml, i have load out phtml file <strong>knockout.phtml<\/strong> with Block <strong>Webkul\\Knockout\\Block\\Account<\/strong><\/p>\n\n\n\n<p>And what about other things in this xml file ? I already explained about it blog: <a href=\"http:\/\/webkul.com\/blog\/intialize-js-component-using-lauyout-xml-magento2\">How to Intialize Js Component Using Layout XML in Magento2<\/a> , you can read it.<\/p>\n\n\n\n<p>b) Ok, now create <strong>knockout.phtml<\/strong> and Block <strong>Webkul\\Knockout\\Block\\Account<\/strong>.<br><strong>Phtml file:<\/strong> <strong>Webkul\/Knockout\/view\/frontend\/templates\/account\/knockout.phtml<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;script&gt;\n    window.customConfig = &lt;?php \/* @escapeNotVerified *\/ echo \\Zend_Json::encode($block-&gt;getCustomConfig()); ?&gt;;\n&lt;\/script&gt;\n\n&lt;div id=&quot;custom-component&quot; data-bind=&quot;scope:&#039;customcomponent&#039;&quot;&gt;\n    &lt;!-- ko template: getTemplate() --&gt;&lt;!-- \/ko --&gt;\n    &lt;script type=&quot;text\/x-magento-init&quot;&gt;\n    {\n        &quot;#custom-component&quot;: {\n            &quot;Magento_Ui\/js\/core\/app&quot;:  &lt;?php \/* @escapeNotVerified *\/ echo $block-&gt;getJsLayout();?&gt;\n        }\n    }\n    &lt;\/script&gt;\n&lt;\/div&gt;<\/pre>\n\n\n\n<p><strong>Block File:<\/strong> <strong>Webkul\/Knockout\/Block\/Account.php<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_Knockout\n * @author    Webkul\n * @copyright Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Webkul\\Knockout\\Block;\n\nclass Account extends \\Magento\\Framework\\View\\Element\\Template\n{\n    \/**\n     * @var array\n     *\/\n    protected $jsLayout;\n\n    \/**\n     * @var \\Webkul\\Knockout\\Model\\CustomConfigProvider\n     *\/\n    protected $configProvider;\n\n    \/**\n     * @param \\Magento\\Framework\\View\\Element\\Template\\Context $context\n     * @param array $data\n     *\/\n    public function __construct(\n        \\Magento\\Framework\\View\\Element\\Template\\Context $context,\n        \\Webkul\\Knockout\\Model\\CustomConfigProvider $configProvider,\n        array $data = &#091;]\n    ) {\n        parent::__construct($context, $data);\n        $this-&gt;jsLayout = isset($data&#091;&#039;jsLayout&#039;]) &amp;&amp; is_array($data&#091;&#039;jsLayout&#039;]) ? $data&#091;&#039;jsLayout&#039;] : &#091;];\n        $this-&gt;configProvider = $configProvider;\n    }\n\n    \/**\n     * @return string\n     *\/\n    public function getJsLayout()\n    {\n        return \\Zend_Json::encode($this-&gt;jsLayout);\n    }\n\n    public function getCustomConfig()\n    {\n        return $this-&gt;configProvider-&gt;getConfig();\n    }\n}<\/pre>\n\n\n\n<p>Now refresh the page, and press F12 find for our <strong>window.customConfig<\/strong><\/p>\n\n\n\n<p>You will see,<br><img decoding=\"async\" class=\"alignnone size-full wp-image-69148\" src=\"http:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_14-1.png\" alt=\"configproviders\" width=\"649\" height=\"79\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_14-1.png 649w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_14-1-250x30.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_14-1-300x37.png 300w\" sizes=\"(max-width: 649px) 100vw, 649px\" loading=\"lazy\" \/><\/p>\n\n\n\n<p>How we can use data from window.customConfig?<br>Here is an another example.<\/p>\n\n\n\n<p>As you can see i have loaded js component as well on our knockout.phtml file.<\/p>\n\n\n\n<p>So let&#8217;s create <strong>Webkul\/Knockout\/view\/frontend\/web\/js\/custom-component.js<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">define(&#091;\n    &#039;jquery&#039;,\n    &#039;uiComponent&#039;,\n    &#039;ko&#039;,\n    ], function ($, Component, ko) {\n        &#039;use strict&#039;;\n        var customData = window.customConfig;\n        return Component.extend({\n            defaults: {\n                template: &#039;Webkul_Knockout\/knockout-test&#039;\n            },\n\n            initialize: function () {\n                this._super();\n                console.log(customData);\n            },\n        });\n    }\n);<\/pre>\n\n\n\n<p>Open Console and check, you will see the data as object.<br><img decoding=\"async\" class=\"alignnone size-full wp-image-69149\" src=\"http:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_15.png\" alt=\"console-data\" width=\"918\" height=\"99\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_15.png 918w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_15-250x27.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_15-300x32.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Screenshot_15-768x83.png 768w\" sizes=\"(max-width: 918px) 100vw, 918px\" loading=\"lazy\" \/><\/p>\n\n\n\n<p>You can have your own custom code in the<strong> Webkul\/Knockout\/view\/frontend\/web\/template\/knockout-test.html<\/strong> file. As an example, you can check the following code:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;div class=&quot;component-wrapper&quot;&gt;\n    &lt;div data-bind=&quot;text: &#039;Knockout Works&#039;&quot;&gt;&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n\n\n\n<p>That&#8217;s It.<\/p>\n\n\n\n<p>I hope it will help you to create Js Based Project.<\/p>\n\n\n\n<p>Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019ll explore how to Create Custom JS Window ConfigProviders in Magento 2 and learn the simplest way to extend JavaScript configuration data. In Magento 2 all required data saved in window.checkoutConfigso at the time of checkout it can be fetched by js models easily.We can also save our custom required data in window.checkoutConfig providers by <a href=\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":69,"featured_media":66844,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2518,302],"tags":[4235,4234,4233],"class_list":["post-69129","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knockoutjs","category-magento2","tag-custom-js-component-magento2","tag-js-config-provider-in-magento2","tag-magento2-config-provider"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to create custom Js window configProviders in Magento 2<\/title>\n<meta name=\"description\" content=\"How to create custom Js window configProviders as Magento&#039;s window.checkoutConfig provider. In Magento 2 all required data saved in window.checkoutConfig\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create custom Js window configProviders in Magento 2\" \/>\n<meta property=\"og:description\" content=\"How to create custom Js window configProviders as Magento&#039;s window.checkoutConfig provider. In Magento 2 all required data saved in window.checkoutConfig\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2016-12-23T08:17:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-11T09:02:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Mahesh Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mahesh Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/\"},\"author\":{\"name\":\"Mahesh Singh\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/53d3b977a0ab5adcf32aef9f97e595bd\"},\"headline\":\"How to create custom Js window configProviders in Magento 2\",\"datePublished\":\"2016-12-23T08:17:12+00:00\",\"dateModified\":\"2025-12-11T09:02:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/\"},\"wordCount\":384,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png\",\"keywords\":[\"Custom Js Component Magento2\",\"Js Config Provider in Magento2\",\"Magento2 Config Provider\"],\"articleSection\":[\"knockoutJs\",\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/\",\"url\":\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/\",\"name\":\"How to create custom Js window configProviders in Magento 2\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png\",\"datePublished\":\"2016-12-23T08:17:12+00:00\",\"dateModified\":\"2025-12-11T09:02:38+00:00\",\"description\":\"How to create custom Js window configProviders as Magento's window.checkoutConfig provider. In Magento 2 all required data saved in window.checkoutConfig\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png\",\"width\":825,\"height\":260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to create custom Js window configProviders in Magento 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/53d3b977a0ab5adcf32aef9f97e595bd\",\"name\":\"Mahesh Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f4c013ebf7008223382b8a49203e6d354677e8baff0eca373e6e4266efa762da?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f4c013ebf7008223382b8a49203e6d354677e8baff0eca373e6e4266efa762da?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Mahesh Singh\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/mahesh721\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to create custom Js window configProviders in Magento 2","description":"How to create custom Js window configProviders as Magento's window.checkoutConfig provider. In Magento 2 all required data saved in window.checkoutConfig","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/","og_locale":"en_US","og_type":"article","og_title":"How to create custom Js window configProviders in Magento 2","og_description":"How to create custom Js window configProviders as Magento's window.checkoutConfig provider. In Magento 2 all required data saved in window.checkoutConfig","og_url":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2016-12-23T08:17:12+00:00","article_modified_time":"2025-12-11T09:02:38+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png","type":"image\/png"}],"author":"Mahesh Singh","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Mahesh Singh","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/"},"author":{"name":"Mahesh Singh","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/53d3b977a0ab5adcf32aef9f97e595bd"},"headline":"How to create custom Js window configProviders in Magento 2","datePublished":"2016-12-23T08:17:12+00:00","dateModified":"2025-12-11T09:02:38+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/"},"wordCount":384,"commentCount":2,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png","keywords":["Custom Js Component Magento2","Js Config Provider in Magento2","Magento2 Config Provider"],"articleSection":["knockoutJs","Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/","url":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/","name":"How to create custom Js window configProviders in Magento 2","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png","datePublished":"2016-12-23T08:17:12+00:00","dateModified":"2025-12-11T09:02:38+00:00","description":"How to create custom Js window configProviders as Magento's window.checkoutConfig provider. In Magento 2 all required data saved in window.checkoutConfig","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png","width":825,"height":260},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/create-custom-js-window-configproviders-magento-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to create custom Js window configProviders in Magento 2"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/53d3b977a0ab5adcf32aef9f97e595bd","name":"Mahesh Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f4c013ebf7008223382b8a49203e6d354677e8baff0eca373e6e4266efa762da?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f4c013ebf7008223382b8a49203e6d354677e8baff0eca373e6e4266efa762da?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Mahesh Singh"},"url":"https:\/\/webkul.com\/blog\/author\/mahesh721\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/69129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/69"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=69129"}],"version-history":[{"count":8,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/69129\/revisions"}],"predecessor-version":[{"id":516449,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/69129\/revisions\/516449"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/66844"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=69129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=69129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=69129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}