I want to see if my module is enabled in config are through html using Knockout JS.

ko if: module_enabled ==1 show a button if not don't show a button But i get this following error Uncaught ReferenceError: Unable to process binding "if: function(){return module_enabled() }" Message: module_enabled is not defined


got the answer

 <type name="Magento\Checkout\Model\CompositeConfigProvider">
            <argument name="configProviders" xsi:type="array">
                <item name="additional" xsi:type="object">{module_name}\Model\AdditionalConfigProvider</item>

 * Retrieve assoc array of checkout configuration
 * @return array
public function getConfig()
    return [
        'foo' => [
            'bar' => 'data',

this is the js file

 getSampleTotal: function () {;
                return window.checkoutConfig.foo.bar;

html ko file

<p data-bind="html: getSampleTotal()"></p>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.