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;
}
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.
magento2 price product-detail-page
add a comment |
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.
magento2 price product-detail-page
add a comment |
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.
magento2 price product-detail-page
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.
magento2 price product-detail-page
magento2 price product-detail-page
edited 15 mins ago
Kirti Nariya
1,252416
1,252416
asked Jan 21 at 9:21
AneesAnees
15712
15712
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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.
add a comment |
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,
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Jan 21 at 10:16
gemig_holgemig_hol
591119
591119
add a comment |
add a comment |
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,
add a comment |
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,
add a comment |
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,
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,
answered Jan 21 at 10:29
Rohan HapaniRohan Hapani
7,04631865
7,04631865
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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