Magento2 disabled product quantity text field to product edit page at admin panelMagento 2.1.0 How to edit admin template of subitem grid of bundle productmagento2 admin panel product edit page Quantity text field is disabled for bundle productHow to remove bundle options from product when loading the admin edit view?How to disable product edit fields based on admin role in magento 2Adding product form to different frontend page in Magento2How I can add tooltip text for SKU product form in magento 2 admin panelCustom Field in Product Edit form in magento2 adminMagento 2 How to make changes to Bundle product edit detail page?Magento 2 admin taking too much to open product edit page for large number of assciated productsMagento 2: How to disable Quantity Box for specific product from checkout cart and minicart

Confusion about Complex Continued Fraction

Can I negotiate a patent idea for a raise, under French law?

How exactly does an Ethernet collision happen in the cable, since nodes use different circuits for Tx and Rx?

Shifting between bemols (flats) and diesis (sharps)in the key signature

How to resolve: Reviewer #1 says remove section X vs. Reviewer #2 says expand section X

Was it really inappropriate to write a pull request for the company I interviewed with?

Doesn't allowing a user mode program to access kernel space memory and execute the IN and OUT instructions defeat the purpose of having CPU modes?

Rationale to prefer local variables over instance variables?

How does Ehrenfest's theorem apply to the quantum harmonic oscillator?

Does an unused member variable take up memory?

What do you call someone who likes to pick fights?

Why does cron require MTA for logging?

Trig Subsitution When There's No Square Root

Outlet with 3 sets of wires

After `ssh` without `-X` to a machine, is it possible to change `$DISPLAY` to make it work like `ssh -X`?

Power Strip for Europe

Are small insurances worth it?

Why is a very small peak with larger m/z not considered to be the molecular ion?

Signed and unsigned numbers

What is Tony Stark injecting into himself in Iron Man 3?

Expressing logarithmic equations without logs

How to check whether module is loaded with custom configurations?

How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?

What are some noteworthy "mic-drop" moments in math?



Magento2 disabled product quantity text field to product edit page at admin panel


Magento 2.1.0 How to edit admin template of subitem grid of bundle productmagento2 admin panel product edit page Quantity text field is disabled for bundle productHow to remove bundle options from product when loading the admin edit view?How to disable product edit fields based on admin role in magento 2Adding product form to different frontend page in Magento2How I can add tooltip text for SKU product form in magento 2 admin panelCustom Field in Product Edit form in magento2 adminMagento 2 How to make changes to Bundle product edit detail page?Magento 2 admin taking too much to open product edit page for large number of assciated productsMagento 2: How to disable Quantity Box for specific product from checkout cart and minicart













1















How can we disable quantity text fields of product edit form at admin side or how can we make it ready only?



We found that it's already disabled with bundle product but we want to do this with all type of products.



Any help or suggestion will be appreciated. Thank you in advance.










share|improve this question






















  • you will have to code this on your own

    – Philipp Sander
    Feb 19 at 13:45











  • Thank you @Philipp Sander, any suggestion for this code?

    – Vish
    Feb 21 at 5:10











  • do you just want the qty field to be disabled in the backend or do you also wan't to restrict API or anything else?

    – Philipp Sander
    Feb 21 at 7:46











  • Just want to disabled in the backed. Just want to make it read-only from product edit page, nothing else

    – Vish
    Feb 21 at 9:32















1















How can we disable quantity text fields of product edit form at admin side or how can we make it ready only?



We found that it's already disabled with bundle product but we want to do this with all type of products.



Any help or suggestion will be appreciated. Thank you in advance.










share|improve this question






















  • you will have to code this on your own

    – Philipp Sander
    Feb 19 at 13:45











  • Thank you @Philipp Sander, any suggestion for this code?

    – Vish
    Feb 21 at 5:10











  • do you just want the qty field to be disabled in the backend or do you also wan't to restrict API or anything else?

    – Philipp Sander
    Feb 21 at 7:46











  • Just want to disabled in the backed. Just want to make it read-only from product edit page, nothing else

    – Vish
    Feb 21 at 9:32













1












1








1








How can we disable quantity text fields of product edit form at admin side or how can we make it ready only?



We found that it's already disabled with bundle product but we want to do this with all type of products.



Any help or suggestion will be appreciated. Thank you in advance.










share|improve this question














How can we disable quantity text fields of product edit form at admin side or how can we make it ready only?



We found that it's already disabled with bundle product but we want to do this with all type of products.



Any help or suggestion will be appreciated. Thank you in advance.







magento2 qua






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 19 at 13:38









VishVish

439317




439317












  • you will have to code this on your own

    – Philipp Sander
    Feb 19 at 13:45











  • Thank you @Philipp Sander, any suggestion for this code?

    – Vish
    Feb 21 at 5:10











  • do you just want the qty field to be disabled in the backend or do you also wan't to restrict API or anything else?

    – Philipp Sander
    Feb 21 at 7:46











  • Just want to disabled in the backed. Just want to make it read-only from product edit page, nothing else

    – Vish
    Feb 21 at 9:32

















  • you will have to code this on your own

    – Philipp Sander
    Feb 19 at 13:45











  • Thank you @Philipp Sander, any suggestion for this code?

    – Vish
    Feb 21 at 5:10











  • do you just want the qty field to be disabled in the backend or do you also wan't to restrict API or anything else?

    – Philipp Sander
    Feb 21 at 7:46











  • Just want to disabled in the backed. Just want to make it read-only from product edit page, nothing else

    – Vish
    Feb 21 at 9:32
















you will have to code this on your own

– Philipp Sander
Feb 19 at 13:45





you will have to code this on your own

– Philipp Sander
Feb 19 at 13:45













Thank you @Philipp Sander, any suggestion for this code?

– Vish
Feb 21 at 5:10





Thank you @Philipp Sander, any suggestion for this code?

– Vish
Feb 21 at 5:10













do you just want the qty field to be disabled in the backend or do you also wan't to restrict API or anything else?

– Philipp Sander
Feb 21 at 7:46





do you just want the qty field to be disabled in the backend or do you also wan't to restrict API or anything else?

– Philipp Sander
Feb 21 at 7:46













Just want to disabled in the backed. Just want to make it read-only from product edit page, nothing else

– Vish
Feb 21 at 9:32





Just want to disabled in the backed. Just want to make it read-only from product edit page, nothing else

– Vish
Feb 21 at 9:32










1 Answer
1






active

oldest

votes


















1














Step 1: Create catalog_product_new.xml file under your_module/view/adminhtml/layout



Below is content of catalog_product_new.xml



<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="js">
<block class="MagentoFrameworkViewElementTemplate" name="js.seller_stock_disabler" template="Rootways_CatalogInventory::product/stock/disabler.phtml"/>
</referenceContainer>
</body>
</page>


Step 2: Create disabler.phtml file under your_module/view/adminthml/templates/product/stock

Below is content of disabler.phtml



<script>
require(['jquery'], function($)
window.afterOptionsInit = function()
if (!jQuery('[data-index = quantity_and_stock_status_qty] input')[0])
setTimeout(function()window.afterOptionsInit();, 500);
return;

$( "[data-index = quantity_and_stock_status_qty] input" ).attr("disabled", "true");
$( "[data-index = quantity_and_stock_status_qty] .admin__field-group-additional" ).hide();

window.afterOptionsInit();
);
</script>





share|improve this answer
























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f262462%2fmagento2-disabled-product-quantity-text-field-to-product-edit-page-at-admin-pane%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Step 1: Create catalog_product_new.xml file under your_module/view/adminhtml/layout



    Below is content of catalog_product_new.xml



    <?xml version="1.0"?>
    <!--
    /**
    * Copyright © Magento, Inc. All rights reserved.
    * See COPYING.txt for license details.
    */
    -->
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
    <referenceContainer name="js">
    <block class="MagentoFrameworkViewElementTemplate" name="js.seller_stock_disabler" template="Rootways_CatalogInventory::product/stock/disabler.phtml"/>
    </referenceContainer>
    </body>
    </page>


    Step 2: Create disabler.phtml file under your_module/view/adminthml/templates/product/stock

    Below is content of disabler.phtml



    <script>
    require(['jquery'], function($)
    window.afterOptionsInit = function()
    if (!jQuery('[data-index = quantity_and_stock_status_qty] input')[0])
    setTimeout(function()window.afterOptionsInit();, 500);
    return;

    $( "[data-index = quantity_and_stock_status_qty] input" ).attr("disabled", "true");
    $( "[data-index = quantity_and_stock_status_qty] .admin__field-group-additional" ).hide();

    window.afterOptionsInit();
    );
    </script>





    share|improve this answer





























      1














      Step 1: Create catalog_product_new.xml file under your_module/view/adminhtml/layout



      Below is content of catalog_product_new.xml



      <?xml version="1.0"?>
      <!--
      /**
      * Copyright © Magento, Inc. All rights reserved.
      * See COPYING.txt for license details.
      */
      -->
      <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
      <body>
      <referenceContainer name="js">
      <block class="MagentoFrameworkViewElementTemplate" name="js.seller_stock_disabler" template="Rootways_CatalogInventory::product/stock/disabler.phtml"/>
      </referenceContainer>
      </body>
      </page>


      Step 2: Create disabler.phtml file under your_module/view/adminthml/templates/product/stock

      Below is content of disabler.phtml



      <script>
      require(['jquery'], function($)
      window.afterOptionsInit = function()
      if (!jQuery('[data-index = quantity_and_stock_status_qty] input')[0])
      setTimeout(function()window.afterOptionsInit();, 500);
      return;

      $( "[data-index = quantity_and_stock_status_qty] input" ).attr("disabled", "true");
      $( "[data-index = quantity_and_stock_status_qty] .admin__field-group-additional" ).hide();

      window.afterOptionsInit();
      );
      </script>





      share|improve this answer



























        1












        1








        1







        Step 1: Create catalog_product_new.xml file under your_module/view/adminhtml/layout



        Below is content of catalog_product_new.xml



        <?xml version="1.0"?>
        <!--
        /**
        * Copyright © Magento, Inc. All rights reserved.
        * See COPYING.txt for license details.
        */
        -->
        <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <body>
        <referenceContainer name="js">
        <block class="MagentoFrameworkViewElementTemplate" name="js.seller_stock_disabler" template="Rootways_CatalogInventory::product/stock/disabler.phtml"/>
        </referenceContainer>
        </body>
        </page>


        Step 2: Create disabler.phtml file under your_module/view/adminthml/templates/product/stock

        Below is content of disabler.phtml



        <script>
        require(['jquery'], function($)
        window.afterOptionsInit = function()
        if (!jQuery('[data-index = quantity_and_stock_status_qty] input')[0])
        setTimeout(function()window.afterOptionsInit();, 500);
        return;

        $( "[data-index = quantity_and_stock_status_qty] input" ).attr("disabled", "true");
        $( "[data-index = quantity_and_stock_status_qty] .admin__field-group-additional" ).hide();

        window.afterOptionsInit();
        );
        </script>





        share|improve this answer















        Step 1: Create catalog_product_new.xml file under your_module/view/adminhtml/layout



        Below is content of catalog_product_new.xml



        <?xml version="1.0"?>
        <!--
        /**
        * Copyright © Magento, Inc. All rights reserved.
        * See COPYING.txt for license details.
        */
        -->
        <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <body>
        <referenceContainer name="js">
        <block class="MagentoFrameworkViewElementTemplate" name="js.seller_stock_disabler" template="Rootways_CatalogInventory::product/stock/disabler.phtml"/>
        </referenceContainer>
        </body>
        </page>


        Step 2: Create disabler.phtml file under your_module/view/adminthml/templates/product/stock

        Below is content of disabler.phtml



        <script>
        require(['jquery'], function($)
        window.afterOptionsInit = function()
        if (!jQuery('[data-index = quantity_and_stock_status_qty] input')[0])
        setTimeout(function()window.afterOptionsInit();, 500);
        return;

        $( "[data-index = quantity_and_stock_status_qty] input" ).attr("disabled", "true");
        $( "[data-index = quantity_and_stock_status_qty] .admin__field-group-additional" ).hide();

        window.afterOptionsInit();
        );
        </script>






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 36 mins ago









        Teja Bhagavan Kollepara

        2,98641947




        2,98641947










        answered Feb 26 at 9:17









        VishVish

        439317




        439317



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f262462%2fmagento2-disabled-product-quantity-text-field-to-product-edit-page-at-admin-pane%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Nidaros erkebispedøme

            Birsay

            Was Woodrow Wilson really a Liberal?Was World War I a war of liberals against authoritarians?Founding Fathers...