Magneto 2: Need to remove decimal from price on product detail page Planned maintenance...

Providing direct feedback to a product salesperson

/bin/ls sorts differently than just ls

Will the Antimagic Field spell cause elementals not summoned by magic to dissipate?

Are Flameskulls resistant to magical piercing damage?

Is Bran literally the world's memory?

What is the definining line between a helicopter and a drone a person can ride in?

Will I be more secure with my own router behind my ISP's router?

How to create a command for the "strange m" symbol in latex?

Assertions In A Mock Callout Test

Is Vivien of the Wilds + Wilderness Reclamation a competitive combo?

Protagonist's race is hidden - should I reveal it?

How to make an animal which can only breed for a certain number of generations?

false 'Security alert' from Google - every login generates mails from 'no-reply@accounts.google.com'

What is the evidence that custom checks in Northern Ireland are going to result in violence?

When does Bran Stark remember Jamie pushing him?

Who's this lady in the war room?

Kepler's 3rd law: ratios don't fit data

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

Pointing to problems without suggesting solutions

"Destructive force" carried by a B-52?

Why doesn't the university give past final exams' answers?

Normal Operator || T^2|| = ||T||^2

How can I introduce the names of fantasy creatures to the reader?

Can this water damage be explained by lack of gutters and grading issues?



Magneto 2: Need to remove decimal from price on product detail page



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?How to remove decimal points from price in Magento 2?Set Discount Price on Product detail pageMagento 2 : How to remove decimal points from the priceMagento2 : Remove decimal from quantityMagento 2: How to remove price decimalremove desimal digits from pricehow to remove decimal value from product price Magento 2?Magento 2.1.5 How to remove zero-only decimal points from the displayed prices, preserving the non-zero one?Need to remove decimal from Discount Price Magento 2How to remove decimal points from price in Magento 2?Magento 2 : How to remove price decimal from product details page





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







0















I want to remove the decimal in price on product details page. Although it removes in listing page, but still showing decimal in discount and final price on product details page.



enter image description here










share|improve this question































    0















    I want to remove the decimal in price on product details page. Although it removes in listing page, but still showing decimal in discount and final price on product details page.



    enter image description here










    share|improve this question



























      0












      0








      0








      I want to remove the decimal in price on product details page. Although it removes in listing page, but still showing decimal in discount and final price on product details page.



      enter image description here










      share|improve this question
















      I want to remove the decimal in price on product details page. Although it removes in listing page, but still showing decimal in discount and final price on product details page.



      enter image description here







      magento2 price product-detail-page






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 15 mins ago









      Kirti Nariya

      1,252416




      1,252416










      asked Jan 21 at 9:21









      AneesAnees

      15712




      15712






















          2 Answers
          2






          active

          oldest

          votes


















          0














          The best way I could find is to change the priceFormat function from Magento_Catolag/js/price-utils.js inside my priceBox.js, so in your requirejs-config.js



          var config = {

          "map": {

          "*": {

          "priceBox" : "Vendor_ModuleName/js/price-box"

          }
          }
          };


          Copy the whole Magento_Catalog/js/price-box.js to your Vendor/ModuleName/view/frontend/web/js/price-box.js and after the use strict add:



          var globalPriceFormat = {

                  requiredPrecision: 2,

                  integerRequired: 1,

                  decimalSymbol: ',',

                  groupSymbol: ',',

                  groupLength: ','

              };


          Under this copy the formatPrice function from price-utils.js



          Change:



          function formatPrice(amount, format, isShowSign) {

          var s = '',

                      precision, integerRequired, decimalSymbol, groupSymbol, groupLength, pattern, i, pad, j, re, r, am;


          To



          function formatPriceHack(amount, format, isShowSign) {
          var s = '',

                      precision = 0, integerRequired, decimalSymbol, groupSymbol, groupLength, pattern, i, pad, j, re, r, am;


          Also comment:



                  



          //precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision;


          And change:



          i = stringPad('0', pad) + i;



          To inside formatPriceHack:



          i = utils.strPad('0', pad) + i;


          And last, change inside the reloadPrice function from priceBox:



          price.formatted = utils.formatPrice(price.final, priceFormat);


          To:



          price.formatted = formatPriceHack(price.final, priceFormat);


          That's it.






          share|improve this answer































            0














            Create file and use this code :



            => From :




            vendor/magento/module-catalog/view/base/templates/product/price/amount/default.phtml




            => To :




            app/design/frontend/VendorName/ModuleName/Magento_Catalog/templates/product/price/amount/default.phtml




            this file is defined from MagentoFrameworkPricingRenderAmount



            The price itself is coming from this call:



            <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>


            If we take a look at the file that this method is created based on the class it's inheriting (/vendor/magento/framework/Pricing/Render/Amount.php)



            Update line no 24



            <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>


            To



            <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer() , 0) ?>


            You need to override




            vendor/magento/module-catalog/view/base/web/js/price-utils.js




            To




            app/design/frontend/VendorName/ModuelName/Magento_Catalog/web/js/price-utils.js




            and change the value of precision on line 38:



            var precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision,


            To



            var precision = 0,





            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%2f258530%2fmagneto-2-need-to-remove-decimal-from-price-on-product-detail-page%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              The best way I could find is to change the priceFormat function from Magento_Catolag/js/price-utils.js inside my priceBox.js, so in your requirejs-config.js



              var config = {

              "map": {

              "*": {

              "priceBox" : "Vendor_ModuleName/js/price-box"

              }
              }
              };


              Copy the whole Magento_Catalog/js/price-box.js to your Vendor/ModuleName/view/frontend/web/js/price-box.js and after the use strict add:



              var globalPriceFormat = {

                      requiredPrecision: 2,

                      integerRequired: 1,

                      decimalSymbol: ',',

                      groupSymbol: ',',

                      groupLength: ','

                  };


              Under this copy the formatPrice function from price-utils.js



              Change:



              function formatPrice(amount, format, isShowSign) {

              var s = '',

                          precision, integerRequired, decimalSymbol, groupSymbol, groupLength, pattern, i, pad, j, re, r, am;


              To



              function formatPriceHack(amount, format, isShowSign) {
              var s = '',

                          precision = 0, integerRequired, decimalSymbol, groupSymbol, groupLength, pattern, i, pad, j, re, r, am;


              Also comment:



                      



              //precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision;


              And change:



              i = stringPad('0', pad) + i;



              To inside formatPriceHack:



              i = utils.strPad('0', pad) + i;


              And last, change inside the reloadPrice function from priceBox:



              price.formatted = utils.formatPrice(price.final, priceFormat);


              To:



              price.formatted = formatPriceHack(price.final, priceFormat);


              That's it.






              share|improve this answer




























                0














                The best way I could find is to change the priceFormat function from Magento_Catolag/js/price-utils.js inside my priceBox.js, so in your requirejs-config.js



                var config = {

                "map": {

                "*": {

                "priceBox" : "Vendor_ModuleName/js/price-box"

                }
                }
                };


                Copy the whole Magento_Catalog/js/price-box.js to your Vendor/ModuleName/view/frontend/web/js/price-box.js and after the use strict add:



                var globalPriceFormat = {

                        requiredPrecision: 2,

                        integerRequired: 1,

                        decimalSymbol: ',',

                        groupSymbol: ',',

                        groupLength: ','

                    };


                Under this copy the formatPrice function from price-utils.js



                Change:



                function formatPrice(amount, format, isShowSign) {

                var s = '',

                            precision, integerRequired, decimalSymbol, groupSymbol, groupLength, pattern, i, pad, j, re, r, am;


                To



                function formatPriceHack(amount, format, isShowSign) {
                var s = '',

                            precision = 0, integerRequired, decimalSymbol, groupSymbol, groupLength, pattern, i, pad, j, re, r, am;


                Also comment:



                        



                //precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision;


                And change:



                i = stringPad('0', pad) + i;



                To inside formatPriceHack:



                i = utils.strPad('0', pad) + i;


                And last, change inside the reloadPrice function from priceBox:



                price.formatted = utils.formatPrice(price.final, priceFormat);


                To:



                price.formatted = formatPriceHack(price.final, priceFormat);


                That's it.






                share|improve this answer


























                  0












                  0








                  0







                  The best way I could find is to change the priceFormat function from Magento_Catolag/js/price-utils.js inside my priceBox.js, so in your requirejs-config.js



                  var config = {

                  "map": {

                  "*": {

                  "priceBox" : "Vendor_ModuleName/js/price-box"

                  }
                  }
                  };


                  Copy the whole Magento_Catalog/js/price-box.js to your Vendor/ModuleName/view/frontend/web/js/price-box.js and after the use strict add:



                  var globalPriceFormat = {

                          requiredPrecision: 2,

                          integerRequired: 1,

                          decimalSymbol: ',',

                          groupSymbol: ',',

                          groupLength: ','

                      };


                  Under this copy the formatPrice function from price-utils.js



                  Change:



                  function formatPrice(amount, format, isShowSign) {

                  var s = '',

                              precision, integerRequired, decimalSymbol, groupSymbol, groupLength, pattern, i, pad, j, re, r, am;


                  To



                  function formatPriceHack(amount, format, isShowSign) {
                  var s = '',

                              precision = 0, integerRequired, decimalSymbol, groupSymbol, groupLength, pattern, i, pad, j, re, r, am;


                  Also comment:



                          



                  //precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision;


                  And change:



                  i = stringPad('0', pad) + i;



                  To inside formatPriceHack:



                  i = utils.strPad('0', pad) + i;


                  And last, change inside the reloadPrice function from priceBox:



                  price.formatted = utils.formatPrice(price.final, priceFormat);


                  To:



                  price.formatted = formatPriceHack(price.final, priceFormat);


                  That's it.






                  share|improve this answer













                  The best way I could find is to change the priceFormat function from Magento_Catolag/js/price-utils.js inside my priceBox.js, so in your requirejs-config.js



                  var config = {

                  "map": {

                  "*": {

                  "priceBox" : "Vendor_ModuleName/js/price-box"

                  }
                  }
                  };


                  Copy the whole Magento_Catalog/js/price-box.js to your Vendor/ModuleName/view/frontend/web/js/price-box.js and after the use strict add:



                  var globalPriceFormat = {

                          requiredPrecision: 2,

                          integerRequired: 1,

                          decimalSymbol: ',',

                          groupSymbol: ',',

                          groupLength: ','

                      };


                  Under this copy the formatPrice function from price-utils.js



                  Change:



                  function formatPrice(amount, format, isShowSign) {

                  var s = '',

                              precision, integerRequired, decimalSymbol, groupSymbol, groupLength, pattern, i, pad, j, re, r, am;


                  To



                  function formatPriceHack(amount, format, isShowSign) {
                  var s = '',

                              precision = 0, integerRequired, decimalSymbol, groupSymbol, groupLength, pattern, i, pad, j, re, r, am;


                  Also comment:



                          



                  //precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision;


                  And change:



                  i = stringPad('0', pad) + i;



                  To inside formatPriceHack:



                  i = utils.strPad('0', pad) + i;


                  And last, change inside the reloadPrice function from priceBox:



                  price.formatted = utils.formatPrice(price.final, priceFormat);


                  To:



                  price.formatted = formatPriceHack(price.final, priceFormat);


                  That's it.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 21 at 10:16









                  gemig_holgemig_hol

                  591119




                  591119

























                      0














                      Create file and use this code :



                      => From :




                      vendor/magento/module-catalog/view/base/templates/product/price/amount/default.phtml




                      => To :




                      app/design/frontend/VendorName/ModuleName/Magento_Catalog/templates/product/price/amount/default.phtml




                      this file is defined from MagentoFrameworkPricingRenderAmount



                      The price itself is coming from this call:



                      <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>


                      If we take a look at the file that this method is created based on the class it's inheriting (/vendor/magento/framework/Pricing/Render/Amount.php)



                      Update line no 24



                      <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>


                      To



                      <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer() , 0) ?>


                      You need to override




                      vendor/magento/module-catalog/view/base/web/js/price-utils.js




                      To




                      app/design/frontend/VendorName/ModuelName/Magento_Catalog/web/js/price-utils.js




                      and change the value of precision on line 38:



                      var precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision,


                      To



                      var precision = 0,





                      share|improve this answer




























                        0














                        Create file and use this code :



                        => From :




                        vendor/magento/module-catalog/view/base/templates/product/price/amount/default.phtml




                        => To :




                        app/design/frontend/VendorName/ModuleName/Magento_Catalog/templates/product/price/amount/default.phtml




                        this file is defined from MagentoFrameworkPricingRenderAmount



                        The price itself is coming from this call:



                        <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>


                        If we take a look at the file that this method is created based on the class it's inheriting (/vendor/magento/framework/Pricing/Render/Amount.php)



                        Update line no 24



                        <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>


                        To



                        <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer() , 0) ?>


                        You need to override




                        vendor/magento/module-catalog/view/base/web/js/price-utils.js




                        To




                        app/design/frontend/VendorName/ModuelName/Magento_Catalog/web/js/price-utils.js




                        and change the value of precision on line 38:



                        var precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision,


                        To



                        var precision = 0,





                        share|improve this answer


























                          0












                          0








                          0







                          Create file and use this code :



                          => From :




                          vendor/magento/module-catalog/view/base/templates/product/price/amount/default.phtml




                          => To :




                          app/design/frontend/VendorName/ModuleName/Magento_Catalog/templates/product/price/amount/default.phtml




                          this file is defined from MagentoFrameworkPricingRenderAmount



                          The price itself is coming from this call:



                          <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>


                          If we take a look at the file that this method is created based on the class it's inheriting (/vendor/magento/framework/Pricing/Render/Amount.php)



                          Update line no 24



                          <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>


                          To



                          <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer() , 0) ?>


                          You need to override




                          vendor/magento/module-catalog/view/base/web/js/price-utils.js




                          To




                          app/design/frontend/VendorName/ModuelName/Magento_Catalog/web/js/price-utils.js




                          and change the value of precision on line 38:



                          var precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision,


                          To



                          var precision = 0,





                          share|improve this answer













                          Create file and use this code :



                          => From :




                          vendor/magento/module-catalog/view/base/templates/product/price/amount/default.phtml




                          => To :




                          app/design/frontend/VendorName/ModuleName/Magento_Catalog/templates/product/price/amount/default.phtml




                          this file is defined from MagentoFrameworkPricingRenderAmount



                          The price itself is coming from this call:



                          <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>


                          If we take a look at the file that this method is created based on the class it's inheriting (/vendor/magento/framework/Pricing/Render/Amount.php)



                          Update line no 24



                          <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>


                          To



                          <?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer() , 0) ?>


                          You need to override




                          vendor/magento/module-catalog/view/base/web/js/price-utils.js




                          To




                          app/design/frontend/VendorName/ModuelName/Magento_Catalog/web/js/price-utils.js




                          and change the value of precision on line 38:



                          var precision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision,


                          To



                          var precision = 0,






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 21 at 10:29









                          Rohan HapaniRohan Hapani

                          7,04631865




                          7,04631865






























                              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%2f258530%2fmagneto-2-need-to-remove-decimal-from-price-on-product-detail-page%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

                              “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

                              How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

                              夢乃愛華...