How to change product zero prices to text in magento 2?Magento - Display different text for different customer groups (depending)Magento 2 configurable product on product list, prices all changeHow to change “add to cart” text on category view?Show product Group Pricesmagento2 admin panel product edit page Quantity text field is disabled for bundle productmagento2 how to change product price while change the value of text field?Magento Division By Zero Warning PHPMagento 2: Change text Upsell in Magento2 Product EditMagento 2 How To Add Custom Text After All PricesChange text in Product Attachement Grid Magento 2

English or Hindi translation of Vyasa Smriti

Where was the County of Thurn und Taxis located?

Conditionally enable edit in lightning:datatable

Are there moral objections to a life motivated purely by money? How to sway a person from this lifestyle?

Has a Nobel Peace laureate ever been accused of war crimes?

Double-nominative constructions and “von”

How to pronounce 'c++' in Spanish

Island of Knights, Knaves and Spies

Bayes factor vs P value

Can a level 2 Warlock take one level in rogue, then continue advancing as a warlock?

Why do distances seem to matter in the Foundation world?

Retract an already submitted recommendation letter (written for an undergrad student)

Check if a string is entirely made of the same substring

Nails holding drywall

How to keep bees out of canned beverages?

Why does Arg'[1. + I] return -0.5?

How much cash can I safely carry into the USA and avoid civil forfeiture?

Crossed out red box fitting tightly around image

What is the term for a person whose job is to place products on shelves in stores?

A ​Note ​on ​N!

How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?

Prove that the countable union of countable sets is also countable

How to find if a column is referenced in a computed column?

A faster way to compute the largest prime factor



How to change product zero prices to text in magento 2?


Magento - Display different text for different customer groups (depending)Magento 2 configurable product on product list, prices all changeHow to change “add to cart” text on category view?Show product Group Pricesmagento2 admin panel product edit page Quantity text field is disabled for bundle productmagento2 how to change product price while change the value of text field?Magento Division By Zero Warning PHPMagento 2: Change text Upsell in Magento2 Product EditMagento 2 How To Add Custom Text After All PricesChange text in Product Attachement Grid Magento 2






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I need to change all product zero prices to custom text - free and enable/disable this function from admin?










share|improve this question









New contributor




Nata is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Do you want to text instead of 0 in frontend PDP?

    – Sohel Rana
    6 hours ago











  • Yes, i want to show them in frontend in all pages where is product.

    – Nata
    6 hours ago

















1















I need to change all product zero prices to custom text - free and enable/disable this function from admin?










share|improve this question









New contributor




Nata is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Do you want to text instead of 0 in frontend PDP?

    – Sohel Rana
    6 hours ago











  • Yes, i want to show them in frontend in all pages where is product.

    – Nata
    6 hours ago













1












1








1








I need to change all product zero prices to custom text - free and enable/disable this function from admin?










share|improve this question









New contributor




Nata is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I need to change all product zero prices to custom text - free and enable/disable this function from admin?







magento2 php






share|improve this question









New contributor




Nata is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Nata is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 6 hours ago







Nata













New contributor




Nata is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 6 hours ago









NataNata

61




61




New contributor




Nata is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Nata is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Nata is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Do you want to text instead of 0 in frontend PDP?

    – Sohel Rana
    6 hours ago











  • Yes, i want to show them in frontend in all pages where is product.

    – Nata
    6 hours ago

















  • Do you want to text instead of 0 in frontend PDP?

    – Sohel Rana
    6 hours ago











  • Yes, i want to show them in frontend in all pages where is product.

    – Nata
    6 hours ago
















Do you want to text instead of 0 in frontend PDP?

– Sohel Rana
6 hours ago





Do you want to text instead of 0 in frontend PDP?

– Sohel Rana
6 hours ago













Yes, i want to show them in frontend in all pages where is product.

– Nata
6 hours ago





Yes, i want to show them in frontend in all pages where is product.

– Nata
6 hours ago










1 Answer
1






active

oldest

votes


















0














This is quite big. But you can go with following way:



For listing and PDP:




app/code/SR/MagentoCommunity/etc/frontend/di.xml




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="MagentoFrameworkPricingRenderPriceBox">
<plugin name="change_text_for_free_product" type="SRMagentoCommunityPluginPricingRenderPriceBox" sortOrder="1"/>
</type>
</config>



app/code/SR/MagentoCommunity/Plugin/Pricing/Render/PriceBox.php




<?php
namespace SRMagentoCommunityPluginPricingRender;

use MagentoFrameworkPricingAmountAmountInterface;

class PriceBox

public function aroundRenderAmount(
MagentoFrameworkPricingRenderPriceBox $subject,
Closure $proceed,
AmountInterface $amount,
array $arguments = []
)
if ($subject->getPrice()->getValue() <= 0)
return 'Free';


return $proceed($amount, $arguments);




For Minicart overwrite following template and add logic:




vendor/magento/module-weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml




For checkout sidebar:




app/code/SR/MagentoCommunity/view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="sidebar" xsi:type="array">
<item name="children" xsi:type="array">
<item name="summary" xsi:type="array">
<item name="children" xsi:type="array">
<item name="cart_items" xsi:type="array">
<item name="children" xsi:type="array">
<item name="details" xsi:type="array">
<item name="children" xsi:type="array">
<item name="subtotal" xsi:type="array">
<item name="children" xsi:type="array">
<item name="weee_row_incl_tax" xsi:type="array">
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">SR_MagentoCommunity/checkout/summary/item/price/row_incl_tax</item>
</item>
</item>
<item name="weee_row_excl_tax" xsi:type="array">
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">SR_MagentoCommunity/checkout/summary/item/price/row_excl_tax</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>


Now copy vendor/magento/module-weee/view/frontend/web/template/checkout/summary/item/price two template and added your logic here.






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
    );



    );






    Nata is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f272467%2fhow-to-change-product-zero-prices-to-text-in-magento-2%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









    0














    This is quite big. But you can go with following way:



    For listing and PDP:




    app/code/SR/MagentoCommunity/etc/frontend/di.xml




    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <type name="MagentoFrameworkPricingRenderPriceBox">
    <plugin name="change_text_for_free_product" type="SRMagentoCommunityPluginPricingRenderPriceBox" sortOrder="1"/>
    </type>
    </config>



    app/code/SR/MagentoCommunity/Plugin/Pricing/Render/PriceBox.php




    <?php
    namespace SRMagentoCommunityPluginPricingRender;

    use MagentoFrameworkPricingAmountAmountInterface;

    class PriceBox

    public function aroundRenderAmount(
    MagentoFrameworkPricingRenderPriceBox $subject,
    Closure $proceed,
    AmountInterface $amount,
    array $arguments = []
    )
    if ($subject->getPrice()->getValue() <= 0)
    return 'Free';


    return $proceed($amount, $arguments);




    For Minicart overwrite following template and add logic:




    vendor/magento/module-weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml




    For checkout sidebar:




    app/code/SR/MagentoCommunity/view/frontend/layout/checkout_index_index.xml




    <?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
    <referenceBlock name="checkout.root">
    <arguments>
    <argument name="jsLayout" xsi:type="array">
    <item name="components" xsi:type="array">
    <item name="checkout" xsi:type="array">
    <item name="children" xsi:type="array">
    <item name="sidebar" xsi:type="array">
    <item name="children" xsi:type="array">
    <item name="summary" xsi:type="array">
    <item name="children" xsi:type="array">
    <item name="cart_items" xsi:type="array">
    <item name="children" xsi:type="array">
    <item name="details" xsi:type="array">
    <item name="children" xsi:type="array">
    <item name="subtotal" xsi:type="array">
    <item name="children" xsi:type="array">
    <item name="weee_row_incl_tax" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="template" xsi:type="string">SR_MagentoCommunity/checkout/summary/item/price/row_incl_tax</item>
    </item>
    </item>
    <item name="weee_row_excl_tax" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="template" xsi:type="string">SR_MagentoCommunity/checkout/summary/item/price/row_excl_tax</item>
    </item>
    </item>
    </item>
    </item>
    </item>
    </item>
    </item>
    </item>
    </item>
    </item>
    </item>
    </item>
    </item>
    </item>
    </item>
    </argument>
    </arguments>
    </referenceBlock>
    </body>
    </page>


    Now copy vendor/magento/module-weee/view/frontend/web/template/checkout/summary/item/price two template and added your logic here.






    share|improve this answer



























      0














      This is quite big. But you can go with following way:



      For listing and PDP:




      app/code/SR/MagentoCommunity/etc/frontend/di.xml




      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

      <type name="MagentoFrameworkPricingRenderPriceBox">
      <plugin name="change_text_for_free_product" type="SRMagentoCommunityPluginPricingRenderPriceBox" sortOrder="1"/>
      </type>
      </config>



      app/code/SR/MagentoCommunity/Plugin/Pricing/Render/PriceBox.php




      <?php
      namespace SRMagentoCommunityPluginPricingRender;

      use MagentoFrameworkPricingAmountAmountInterface;

      class PriceBox

      public function aroundRenderAmount(
      MagentoFrameworkPricingRenderPriceBox $subject,
      Closure $proceed,
      AmountInterface $amount,
      array $arguments = []
      )
      if ($subject->getPrice()->getValue() <= 0)
      return 'Free';


      return $proceed($amount, $arguments);




      For Minicart overwrite following template and add logic:




      vendor/magento/module-weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml




      For checkout sidebar:




      app/code/SR/MagentoCommunity/view/frontend/layout/checkout_index_index.xml




      <?xml version="1.0"?>
      <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
      <body>
      <referenceBlock name="checkout.root">
      <arguments>
      <argument name="jsLayout" xsi:type="array">
      <item name="components" xsi:type="array">
      <item name="checkout" xsi:type="array">
      <item name="children" xsi:type="array">
      <item name="sidebar" xsi:type="array">
      <item name="children" xsi:type="array">
      <item name="summary" xsi:type="array">
      <item name="children" xsi:type="array">
      <item name="cart_items" xsi:type="array">
      <item name="children" xsi:type="array">
      <item name="details" xsi:type="array">
      <item name="children" xsi:type="array">
      <item name="subtotal" xsi:type="array">
      <item name="children" xsi:type="array">
      <item name="weee_row_incl_tax" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="template" xsi:type="string">SR_MagentoCommunity/checkout/summary/item/price/row_incl_tax</item>
      </item>
      </item>
      <item name="weee_row_excl_tax" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="template" xsi:type="string">SR_MagentoCommunity/checkout/summary/item/price/row_excl_tax</item>
      </item>
      </item>
      </item>
      </item>
      </item>
      </item>
      </item>
      </item>
      </item>
      </item>
      </item>
      </item>
      </item>
      </item>
      </item>
      </argument>
      </arguments>
      </referenceBlock>
      </body>
      </page>


      Now copy vendor/magento/module-weee/view/frontend/web/template/checkout/summary/item/price two template and added your logic here.






      share|improve this answer

























        0












        0








        0







        This is quite big. But you can go with following way:



        For listing and PDP:




        app/code/SR/MagentoCommunity/etc/frontend/di.xml




        <?xml version="1.0"?>
        <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

        <type name="MagentoFrameworkPricingRenderPriceBox">
        <plugin name="change_text_for_free_product" type="SRMagentoCommunityPluginPricingRenderPriceBox" sortOrder="1"/>
        </type>
        </config>



        app/code/SR/MagentoCommunity/Plugin/Pricing/Render/PriceBox.php




        <?php
        namespace SRMagentoCommunityPluginPricingRender;

        use MagentoFrameworkPricingAmountAmountInterface;

        class PriceBox

        public function aroundRenderAmount(
        MagentoFrameworkPricingRenderPriceBox $subject,
        Closure $proceed,
        AmountInterface $amount,
        array $arguments = []
        )
        if ($subject->getPrice()->getValue() <= 0)
        return 'Free';


        return $proceed($amount, $arguments);




        For Minicart overwrite following template and add logic:




        vendor/magento/module-weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml




        For checkout sidebar:




        app/code/SR/MagentoCommunity/view/frontend/layout/checkout_index_index.xml




        <?xml version="1.0"?>
        <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <body>
        <referenceBlock name="checkout.root">
        <arguments>
        <argument name="jsLayout" xsi:type="array">
        <item name="components" xsi:type="array">
        <item name="checkout" xsi:type="array">
        <item name="children" xsi:type="array">
        <item name="sidebar" xsi:type="array">
        <item name="children" xsi:type="array">
        <item name="summary" xsi:type="array">
        <item name="children" xsi:type="array">
        <item name="cart_items" xsi:type="array">
        <item name="children" xsi:type="array">
        <item name="details" xsi:type="array">
        <item name="children" xsi:type="array">
        <item name="subtotal" xsi:type="array">
        <item name="children" xsi:type="array">
        <item name="weee_row_incl_tax" xsi:type="array">
        <item name="config" xsi:type="array">
        <item name="template" xsi:type="string">SR_MagentoCommunity/checkout/summary/item/price/row_incl_tax</item>
        </item>
        </item>
        <item name="weee_row_excl_tax" xsi:type="array">
        <item name="config" xsi:type="array">
        <item name="template" xsi:type="string">SR_MagentoCommunity/checkout/summary/item/price/row_excl_tax</item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </argument>
        </arguments>
        </referenceBlock>
        </body>
        </page>


        Now copy vendor/magento/module-weee/view/frontend/web/template/checkout/summary/item/price two template and added your logic here.






        share|improve this answer













        This is quite big. But you can go with following way:



        For listing and PDP:




        app/code/SR/MagentoCommunity/etc/frontend/di.xml




        <?xml version="1.0"?>
        <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

        <type name="MagentoFrameworkPricingRenderPriceBox">
        <plugin name="change_text_for_free_product" type="SRMagentoCommunityPluginPricingRenderPriceBox" sortOrder="1"/>
        </type>
        </config>



        app/code/SR/MagentoCommunity/Plugin/Pricing/Render/PriceBox.php




        <?php
        namespace SRMagentoCommunityPluginPricingRender;

        use MagentoFrameworkPricingAmountAmountInterface;

        class PriceBox

        public function aroundRenderAmount(
        MagentoFrameworkPricingRenderPriceBox $subject,
        Closure $proceed,
        AmountInterface $amount,
        array $arguments = []
        )
        if ($subject->getPrice()->getValue() <= 0)
        return 'Free';


        return $proceed($amount, $arguments);




        For Minicart overwrite following template and add logic:




        vendor/magento/module-weee/view/frontend/templates/checkout/cart/item/price/sidebar.phtml




        For checkout sidebar:




        app/code/SR/MagentoCommunity/view/frontend/layout/checkout_index_index.xml




        <?xml version="1.0"?>
        <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <body>
        <referenceBlock name="checkout.root">
        <arguments>
        <argument name="jsLayout" xsi:type="array">
        <item name="components" xsi:type="array">
        <item name="checkout" xsi:type="array">
        <item name="children" xsi:type="array">
        <item name="sidebar" xsi:type="array">
        <item name="children" xsi:type="array">
        <item name="summary" xsi:type="array">
        <item name="children" xsi:type="array">
        <item name="cart_items" xsi:type="array">
        <item name="children" xsi:type="array">
        <item name="details" xsi:type="array">
        <item name="children" xsi:type="array">
        <item name="subtotal" xsi:type="array">
        <item name="children" xsi:type="array">
        <item name="weee_row_incl_tax" xsi:type="array">
        <item name="config" xsi:type="array">
        <item name="template" xsi:type="string">SR_MagentoCommunity/checkout/summary/item/price/row_incl_tax</item>
        </item>
        </item>
        <item name="weee_row_excl_tax" xsi:type="array">
        <item name="config" xsi:type="array">
        <item name="template" xsi:type="string">SR_MagentoCommunity/checkout/summary/item/price/row_excl_tax</item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </item>
        </argument>
        </arguments>
        </referenceBlock>
        </body>
        </page>


        Now copy vendor/magento/module-weee/view/frontend/web/template/checkout/summary/item/price two template and added your logic here.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 4 hours ago









        Sohel RanaSohel Rana

        23.6k34461




        23.6k34461




















            Nata is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            Nata is a new contributor. Be nice, and check out our Code of Conduct.












            Nata is a new contributor. Be nice, and check out our Code of Conduct.











            Nata is a new contributor. Be nice, and check out our Code of Conduct.














            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%2f272467%2fhow-to-change-product-zero-prices-to-text-in-magento-2%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

            六本木駅

            Integral that is continuous and looks like it converges to a geometric seriesTesting if a geometric series converges by taking limit to infinitySummation of arithmetic-geometric series of higher orderGeometric series with polynomial exponentHow to Recognize a Geometric SeriesShowing an integral equality with series over the integersDiscontinuity of a series of continuous functionsReasons why a Series ConvergesSum of infinite geometric series with two terms in summationUsing geometric series for computing IntegralsLimit of geometric series sum when $r = 1$

            Joseph Lister