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;








4















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?










share|improve this question




























    4















    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?










    share|improve this question
























      4












      4








      4


      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?










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 15 at 15:04









      Henk ZHenk Z

      93263673




      93263673




















          2 Answers
          2






          active

          oldest

          votes


















          2














          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.






          share|improve this answer























          • 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


















          0














          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>





          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%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









            2














            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.






            share|improve this answer























            • 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















            2














            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.






            share|improve this answer























            • 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













            2












            2








            2







            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.






            share|improve this answer













            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.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            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

















            • 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













            0














            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>





            share|improve this answer



























              0














              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>





              share|improve this answer

























                0












                0








                0







                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>





                share|improve this answer













                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>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 23 at 16:05









                JarxbergJarxberg

                155




                155



























                    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%2f262016%2fmagento-2-3-minicart-check-if-subtotal-is-above-value%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

                    Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                    Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form