Magento 2.3 Minicart check if subtotal is above valueCheck if subtotal is below 30.00Magento 2 Overriding template is not workingHow do I load JavaScript function inside KnockoutJS html?Magento 2 : Minicart Header ChangeMagento 2 - Knockout js minicartMagento 2 in minicart popup need qty incrementer and decrementerHow to modify minicart.js Magento 2?Loading Javascript for minicart in Magento 2Magento 2.3 add shipping line to cart totalsHow to override minicart html with custom phtml?
Aliens crash on Earth and go into stasis to wait for technology to fix their ship
Philosophical question on logistic regression: why isn't the optimal threshold value trained?
How do I reattach a shelf to the wall when it ripped out of the wall?
What is causing the white spot to appear in some of my pictures
Can someone publish a story that happened to you?
If a planet has 3 moons, is it possible to have triple Full/New Moons at once?
What are the steps to solving this definite integral?
Can I criticise the more senior developers around me for not writing clean code?
How does Captain America channel this power?
Two field separators (colon and space) in awk
What is the philosophical significance of speech acts/implicature?
Don’t seats that recline flat defeat the purpose of having seatbelts?
Aligning equation numbers vertically
Implications of cigar-shaped bodies having rings?
What's the polite way to say "I need to urinate"?
"You've called the wrong number" or "You called the wrong number"
Classification of surfaces
Why did C use the -> operator instead of reusing the . operator?
Can we say “you can pay when the order gets ready”?
As an international instructor, should I openly talk about my accent?
Is the claim "Employers won't employ people with no 'social media presence'" realistic?
Minor Revision with suggestion of an alternative proof by reviewer
Like totally amazing interchangeable sister outfits II: The Revenge
Why does Mind Blank stop the Feeblemind spell?
Magento 2.3 Minicart check if subtotal is above value
Check if subtotal is below 30.00Magento 2 Overriding template is not workingHow do I load JavaScript function inside KnockoutJS html?Magento 2 : Minicart Header ChangeMagento 2 - Knockout js minicartMagento 2 in minicart popup need qty incrementer and decrementerHow to modify minicart.js Magento 2?Loading Javascript for minicart in Magento 2Magento 2.3 add shipping line to cart totalsHow to override minicart html with custom phtml?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to check inside my /app/design/frontend/theme/theme/Magento_Checkout/web/template/minicart/subtotal/totals.html
file if the subtotal is larger than 29.95.
I want to display some additional text if subtotal is larger or smaller than 29.95. The problem is that it is loaded inside a .html file so I cannot use php for this.
How can I achieve this?
magento2 cart mini-cart
add a comment |
I want to check inside my /app/design/frontend/theme/theme/Magento_Checkout/web/template/minicart/subtotal/totals.html
file if the subtotal is larger than 29.95.
I want to display some additional text if subtotal is larger or smaller than 29.95. The problem is that it is loaded inside a .html file so I cannot use php for this.
How can I achieve this?
magento2 cart mini-cart
add a comment |
I want to check inside my /app/design/frontend/theme/theme/Magento_Checkout/web/template/minicart/subtotal/totals.html
file if the subtotal is larger than 29.95.
I want to display some additional text if subtotal is larger or smaller than 29.95. The problem is that it is loaded inside a .html file so I cannot use php for this.
How can I achieve this?
magento2 cart mini-cart
I want to check inside my /app/design/frontend/theme/theme/Magento_Checkout/web/template/minicart/subtotal/totals.html
file if the subtotal is larger than 29.95.
I want to display some additional text if subtotal is larger or smaller than 29.95. The problem is that it is loaded inside a .html file so I cannot use php for this.
How can I achieve this?
magento2 cart mini-cart
magento2 cart mini-cart
asked Feb 15 at 15:04
Henk ZHenk Z
93263673
93263673
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You can have following knockout code in html file to achieve your desired result.
<!-- ko if: cart().subtotalAmount < 29.95 -->
<span>custom message if subtotal is less then 29.95</span>
<!-- /ko -->
<!-- ko if: cart().subtotalAmount > 29.95 -->
<span>custom message if subtotal is greater then 29.95</span>
<!-- /ko -->
Hope this helps.
Thanks! I tried it, but it does display the message both. So it does not check if the subtotal is greater than 29.95.
– Henk Z
Feb 17 at 20:17
This is something related to static content deploy so after making the change you need to remove var/view_preprocessor/* and pub/static/frontend/* then php bin/magento setup:static-content:deploy -f and finally php bin/magento cache:flush ... To make sure weather ur changes reflected or not try appending some custom text without any conditions ...
– Yash Shah
Feb 17 at 20:21
Thanks! I did indeed deploy the static content, but it seems that the if element does not work. I added the code into/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicartsubtotal.html
– Henk Z
Feb 17 at 20:42
Strange !!! I tested the code and was working for me ... Anyways good luck ...
– Yash Shah
Feb 17 at 20:50
It indeed works fine, it was the static folder that did not flush well. Many thanks. But the only thing I face now, is that the best way to implement this, would be to create a new template file, instead of adding it to the/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicart/subtotal.html
Is there a easy way to add a new file and display this above the subtotal.html file?
– Henk Z
Feb 17 at 21:07
|
show 4 more comments
Yash Shah's answer worked for me, but only after I found the right place for the code. I added it inside an existing 'ko' element (I'm not familiar with Knockout).
I edited my subtotal.html from this...
<div class="subtotal">
<span class="label">
<!-- ko i18n: 'Cart Subtotal' --><!-- /ko -->
</span>
<!-- ko foreach: elems -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</div>
...to this...
<div class="subtotal">
<span class="label">
<!-- ko i18n: 'Cart Subtotal' --><!-- /ko -->
</span>
<!-- ko foreach: elems -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- ko if: cart().subtotalAmount < 50.00 -->
<span>Message for orders under £50</span>
<!-- /ko -->
<!-- ko if: cart().subtotalAmount > 50.00 -->
<span>Message for orders over £50</span>
<!-- /ko -->
<!-- /ko -->
</div>
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%2f262016%2fmagento-2-3-minicart-check-if-subtotal-is-above-value%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
You can have following knockout code in html file to achieve your desired result.
<!-- ko if: cart().subtotalAmount < 29.95 -->
<span>custom message if subtotal is less then 29.95</span>
<!-- /ko -->
<!-- ko if: cart().subtotalAmount > 29.95 -->
<span>custom message if subtotal is greater then 29.95</span>
<!-- /ko -->
Hope this helps.
Thanks! I tried it, but it does display the message both. So it does not check if the subtotal is greater than 29.95.
– Henk Z
Feb 17 at 20:17
This is something related to static content deploy so after making the change you need to remove var/view_preprocessor/* and pub/static/frontend/* then php bin/magento setup:static-content:deploy -f and finally php bin/magento cache:flush ... To make sure weather ur changes reflected or not try appending some custom text without any conditions ...
– Yash Shah
Feb 17 at 20:21
Thanks! I did indeed deploy the static content, but it seems that the if element does not work. I added the code into/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicartsubtotal.html
– Henk Z
Feb 17 at 20:42
Strange !!! I tested the code and was working for me ... Anyways good luck ...
– Yash Shah
Feb 17 at 20:50
It indeed works fine, it was the static folder that did not flush well. Many thanks. But the only thing I face now, is that the best way to implement this, would be to create a new template file, instead of adding it to the/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicart/subtotal.html
Is there a easy way to add a new file and display this above the subtotal.html file?
– Henk Z
Feb 17 at 21:07
|
show 4 more comments
You can have following knockout code in html file to achieve your desired result.
<!-- ko if: cart().subtotalAmount < 29.95 -->
<span>custom message if subtotal is less then 29.95</span>
<!-- /ko -->
<!-- ko if: cart().subtotalAmount > 29.95 -->
<span>custom message if subtotal is greater then 29.95</span>
<!-- /ko -->
Hope this helps.
Thanks! I tried it, but it does display the message both. So it does not check if the subtotal is greater than 29.95.
– Henk Z
Feb 17 at 20:17
This is something related to static content deploy so after making the change you need to remove var/view_preprocessor/* and pub/static/frontend/* then php bin/magento setup:static-content:deploy -f and finally php bin/magento cache:flush ... To make sure weather ur changes reflected or not try appending some custom text without any conditions ...
– Yash Shah
Feb 17 at 20:21
Thanks! I did indeed deploy the static content, but it seems that the if element does not work. I added the code into/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicartsubtotal.html
– Henk Z
Feb 17 at 20:42
Strange !!! I tested the code and was working for me ... Anyways good luck ...
– Yash Shah
Feb 17 at 20:50
It indeed works fine, it was the static folder that did not flush well. Many thanks. But the only thing I face now, is that the best way to implement this, would be to create a new template file, instead of adding it to the/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicart/subtotal.html
Is there a easy way to add a new file and display this above the subtotal.html file?
– Henk Z
Feb 17 at 21:07
|
show 4 more comments
You can have following knockout code in html file to achieve your desired result.
<!-- ko if: cart().subtotalAmount < 29.95 -->
<span>custom message if subtotal is less then 29.95</span>
<!-- /ko -->
<!-- ko if: cart().subtotalAmount > 29.95 -->
<span>custom message if subtotal is greater then 29.95</span>
<!-- /ko -->
Hope this helps.
You can have following knockout code in html file to achieve your desired result.
<!-- ko if: cart().subtotalAmount < 29.95 -->
<span>custom message if subtotal is less then 29.95</span>
<!-- /ko -->
<!-- ko if: cart().subtotalAmount > 29.95 -->
<span>custom message if subtotal is greater then 29.95</span>
<!-- /ko -->
Hope this helps.
answered Feb 15 at 21:47
Yash ShahYash Shah
98129
98129
Thanks! I tried it, but it does display the message both. So it does not check if the subtotal is greater than 29.95.
– Henk Z
Feb 17 at 20:17
This is something related to static content deploy so after making the change you need to remove var/view_preprocessor/* and pub/static/frontend/* then php bin/magento setup:static-content:deploy -f and finally php bin/magento cache:flush ... To make sure weather ur changes reflected or not try appending some custom text without any conditions ...
– Yash Shah
Feb 17 at 20:21
Thanks! I did indeed deploy the static content, but it seems that the if element does not work. I added the code into/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicartsubtotal.html
– Henk Z
Feb 17 at 20:42
Strange !!! I tested the code and was working for me ... Anyways good luck ...
– Yash Shah
Feb 17 at 20:50
It indeed works fine, it was the static folder that did not flush well. Many thanks. But the only thing I face now, is that the best way to implement this, would be to create a new template file, instead of adding it to the/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicart/subtotal.html
Is there a easy way to add a new file and display this above the subtotal.html file?
– Henk Z
Feb 17 at 21:07
|
show 4 more comments
Thanks! I tried it, but it does display the message both. So it does not check if the subtotal is greater than 29.95.
– Henk Z
Feb 17 at 20:17
This is something related to static content deploy so after making the change you need to remove var/view_preprocessor/* and pub/static/frontend/* then php bin/magento setup:static-content:deploy -f and finally php bin/magento cache:flush ... To make sure weather ur changes reflected or not try appending some custom text without any conditions ...
– Yash Shah
Feb 17 at 20:21
Thanks! I did indeed deploy the static content, but it seems that the if element does not work. I added the code into/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicartsubtotal.html
– Henk Z
Feb 17 at 20:42
Strange !!! I tested the code and was working for me ... Anyways good luck ...
– Yash Shah
Feb 17 at 20:50
It indeed works fine, it was the static folder that did not flush well. Many thanks. But the only thing I face now, is that the best way to implement this, would be to create a new template file, instead of adding it to the/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicart/subtotal.html
Is there a easy way to add a new file and display this above the subtotal.html file?
– Henk Z
Feb 17 at 21:07
Thanks! I tried it, but it does display the message both. So it does not check if the subtotal is greater than 29.95.
– Henk Z
Feb 17 at 20:17
Thanks! I tried it, but it does display the message both. So it does not check if the subtotal is greater than 29.95.
– Henk Z
Feb 17 at 20:17
This is something related to static content deploy so after making the change you need to remove var/view_preprocessor/* and pub/static/frontend/* then php bin/magento setup:static-content:deploy -f and finally php bin/magento cache:flush ... To make sure weather ur changes reflected or not try appending some custom text without any conditions ...
– Yash Shah
Feb 17 at 20:21
This is something related to static content deploy so after making the change you need to remove var/view_preprocessor/* and pub/static/frontend/* then php bin/magento setup:static-content:deploy -f and finally php bin/magento cache:flush ... To make sure weather ur changes reflected or not try appending some custom text without any conditions ...
– Yash Shah
Feb 17 at 20:21
Thanks! I did indeed deploy the static content, but it seems that the if element does not work. I added the code into
/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicartsubtotal.html
– Henk Z
Feb 17 at 20:42
Thanks! I did indeed deploy the static content, but it seems that the if element does not work. I added the code into
/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicartsubtotal.html
– Henk Z
Feb 17 at 20:42
Strange !!! I tested the code and was working for me ... Anyways good luck ...
– Yash Shah
Feb 17 at 20:50
Strange !!! I tested the code and was working for me ... Anyways good luck ...
– Yash Shah
Feb 17 at 20:50
It indeed works fine, it was the static folder that did not flush well. Many thanks. But the only thing I face now, is that the best way to implement this, would be to create a new template file, instead of adding it to the
/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicart/subtotal.html
Is there a easy way to add a new file and display this above the subtotal.html file?– Henk Z
Feb 17 at 21:07
It indeed works fine, it was the static folder that did not flush well. Many thanks. But the only thing I face now, is that the best way to implement this, would be to create a new template file, instead of adding it to the
/app/design/frontend/theme/theme/Magento_Checkout/web/template/minicart/subtotal.html
Is there a easy way to add a new file and display this above the subtotal.html file?– Henk Z
Feb 17 at 21:07
|
show 4 more comments
Yash Shah's answer worked for me, but only after I found the right place for the code. I added it inside an existing 'ko' element (I'm not familiar with Knockout).
I edited my subtotal.html from this...
<div class="subtotal">
<span class="label">
<!-- ko i18n: 'Cart Subtotal' --><!-- /ko -->
</span>
<!-- ko foreach: elems -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</div>
...to this...
<div class="subtotal">
<span class="label">
<!-- ko i18n: 'Cart Subtotal' --><!-- /ko -->
</span>
<!-- ko foreach: elems -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- ko if: cart().subtotalAmount < 50.00 -->
<span>Message for orders under £50</span>
<!-- /ko -->
<!-- ko if: cart().subtotalAmount > 50.00 -->
<span>Message for orders over £50</span>
<!-- /ko -->
<!-- /ko -->
</div>
add a comment |
Yash Shah's answer worked for me, but only after I found the right place for the code. I added it inside an existing 'ko' element (I'm not familiar with Knockout).
I edited my subtotal.html from this...
<div class="subtotal">
<span class="label">
<!-- ko i18n: 'Cart Subtotal' --><!-- /ko -->
</span>
<!-- ko foreach: elems -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</div>
...to this...
<div class="subtotal">
<span class="label">
<!-- ko i18n: 'Cart Subtotal' --><!-- /ko -->
</span>
<!-- ko foreach: elems -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- ko if: cart().subtotalAmount < 50.00 -->
<span>Message for orders under £50</span>
<!-- /ko -->
<!-- ko if: cart().subtotalAmount > 50.00 -->
<span>Message for orders over £50</span>
<!-- /ko -->
<!-- /ko -->
</div>
add a comment |
Yash Shah's answer worked for me, but only after I found the right place for the code. I added it inside an existing 'ko' element (I'm not familiar with Knockout).
I edited my subtotal.html from this...
<div class="subtotal">
<span class="label">
<!-- ko i18n: 'Cart Subtotal' --><!-- /ko -->
</span>
<!-- ko foreach: elems -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</div>
...to this...
<div class="subtotal">
<span class="label">
<!-- ko i18n: 'Cart Subtotal' --><!-- /ko -->
</span>
<!-- ko foreach: elems -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- ko if: cart().subtotalAmount < 50.00 -->
<span>Message for orders under £50</span>
<!-- /ko -->
<!-- ko if: cart().subtotalAmount > 50.00 -->
<span>Message for orders over £50</span>
<!-- /ko -->
<!-- /ko -->
</div>
Yash Shah's answer worked for me, but only after I found the right place for the code. I added it inside an existing 'ko' element (I'm not familiar with Knockout).
I edited my subtotal.html from this...
<div class="subtotal">
<span class="label">
<!-- ko i18n: 'Cart Subtotal' --><!-- /ko -->
</span>
<!-- ko foreach: elems -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</div>
...to this...
<div class="subtotal">
<span class="label">
<!-- ko i18n: 'Cart Subtotal' --><!-- /ko -->
</span>
<!-- ko foreach: elems -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- ko if: cart().subtotalAmount < 50.00 -->
<span>Message for orders under £50</span>
<!-- /ko -->
<!-- ko if: cart().subtotalAmount > 50.00 -->
<span>Message for orders over £50</span>
<!-- /ko -->
<!-- /ko -->
</div>
answered Apr 23 at 16:05
JarxbergJarxberg
155
155
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%2f262016%2fmagento-2-3-minicart-check-if-subtotal-is-above-value%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