woocommerce cart coupon price without tax to display











up vote
-1
down vote

favorite












I want woocommerce to display price in cart without tax, reduced by using a coupon.



I want to have:




  • price without tax

  • coupon value

  • price without tax reduced by coupon

  • tax

  • price with tax


Can anybody help me please?



I was trying to play wit this code:



add_action( 'woocommerce_cart_calculate_fees','new_customers_discount', 10, 1 );
function new_customers_discount( $wc_cart ) {
if ( is_admin() && ! defined('DOING_AJAX') ) // We exit

// Only for logged in users
if ($woocommerce->cart->applied_coupons) // We exit

// Only for new customers without orders
if ( wc_get_customer_order_count( get_current_user_id() ) != 10000 ) return; // We exit


// Calculation
$discount = $wc_cart->cart_contents_total - $coupon ;

$wc_cart->add_fee( __( 'Netto po rabacie', 'woocommerce')."", $discount);
echo '<div id="product-meta"><span class="detaliczna"><p class="item-description" style="text-align:center; font-size: 14px; display: none; ">' . $wc_cart->add_fee( __( 'TEST', 'woocommerce')."", -$discount ) . ' zł netto</p></span></div>';


but no luck. I am not a programmer. :)










share|improve this question







New contributor




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
























    up vote
    -1
    down vote

    favorite












    I want woocommerce to display price in cart without tax, reduced by using a coupon.



    I want to have:




    • price without tax

    • coupon value

    • price without tax reduced by coupon

    • tax

    • price with tax


    Can anybody help me please?



    I was trying to play wit this code:



    add_action( 'woocommerce_cart_calculate_fees','new_customers_discount', 10, 1 );
    function new_customers_discount( $wc_cart ) {
    if ( is_admin() && ! defined('DOING_AJAX') ) // We exit

    // Only for logged in users
    if ($woocommerce->cart->applied_coupons) // We exit

    // Only for new customers without orders
    if ( wc_get_customer_order_count( get_current_user_id() ) != 10000 ) return; // We exit


    // Calculation
    $discount = $wc_cart->cart_contents_total - $coupon ;

    $wc_cart->add_fee( __( 'Netto po rabacie', 'woocommerce')."", $discount);
    echo '<div id="product-meta"><span class="detaliczna"><p class="item-description" style="text-align:center; font-size: 14px; display: none; ">' . $wc_cart->add_fee( __( 'TEST', 'woocommerce')."", -$discount ) . ' zł netto</p></span></div>';


    but no luck. I am not a programmer. :)










    share|improve this question







    New contributor




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






















      up vote
      -1
      down vote

      favorite









      up vote
      -1
      down vote

      favorite











      I want woocommerce to display price in cart without tax, reduced by using a coupon.



      I want to have:




      • price without tax

      • coupon value

      • price without tax reduced by coupon

      • tax

      • price with tax


      Can anybody help me please?



      I was trying to play wit this code:



      add_action( 'woocommerce_cart_calculate_fees','new_customers_discount', 10, 1 );
      function new_customers_discount( $wc_cart ) {
      if ( is_admin() && ! defined('DOING_AJAX') ) // We exit

      // Only for logged in users
      if ($woocommerce->cart->applied_coupons) // We exit

      // Only for new customers without orders
      if ( wc_get_customer_order_count( get_current_user_id() ) != 10000 ) return; // We exit


      // Calculation
      $discount = $wc_cart->cart_contents_total - $coupon ;

      $wc_cart->add_fee( __( 'Netto po rabacie', 'woocommerce')."", $discount);
      echo '<div id="product-meta"><span class="detaliczna"><p class="item-description" style="text-align:center; font-size: 14px; display: none; ">' . $wc_cart->add_fee( __( 'TEST', 'woocommerce')."", -$discount ) . ' zł netto</p></span></div>';


      but no luck. I am not a programmer. :)










      share|improve this question







      New contributor




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











      I want woocommerce to display price in cart without tax, reduced by using a coupon.



      I want to have:




      • price without tax

      • coupon value

      • price without tax reduced by coupon

      • tax

      • price with tax


      Can anybody help me please?



      I was trying to play wit this code:



      add_action( 'woocommerce_cart_calculate_fees','new_customers_discount', 10, 1 );
      function new_customers_discount( $wc_cart ) {
      if ( is_admin() && ! defined('DOING_AJAX') ) // We exit

      // Only for logged in users
      if ($woocommerce->cart->applied_coupons) // We exit

      // Only for new customers without orders
      if ( wc_get_customer_order_count( get_current_user_id() ) != 10000 ) return; // We exit


      // Calculation
      $discount = $wc_cart->cart_contents_total - $coupon ;

      $wc_cart->add_fee( __( 'Netto po rabacie', 'woocommerce')."", $discount);
      echo '<div id="product-meta"><span class="detaliczna"><p class="item-description" style="text-align:center; font-size: 14px; display: none; ">' . $wc_cart->add_fee( __( 'TEST', 'woocommerce')."", -$discount ) . ' zł netto</p></span></div>';


      but no luck. I am not a programmer. :)







      woocommerce cart coupon tax






      share|improve this question







      New contributor




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











      share|improve this question







      New contributor




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









      share|improve this question




      share|improve this question






      New contributor




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









      asked yesterday









      Lukasz Beldowski

      1




      1




      New contributor




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





      New contributor





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






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
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          I got it, but i want to change the order. I want to move the nett price on top of VAT



          add_action( 'woocommerce_cart_totals_before_order_total', 'bbloomer_wc_discount_total_30', 10, 1 );
          add_action( 'woocommerce_review_order_before_order_total', 'bbloomer_wc_discount_total_30', 10, 1 );
          function bbloomer_wc_discount_total_30() {


          global $woocommerce;

          $discount_total = 0;

          foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values) {

          $_product = $values['data'];

          if ( $_product->get_regular_price() ) {
          $regular_price = $_product->get_regular_price();
          $sale_price = $_product->get_sale_price();
          $discount = ($regular_price - $coupon) ;
          $discount_total += $discount;
          }

          }

          if ( $discount_total > 0 ) {
          echo '<tr class="cart-discount">
          <th>'. __( 'Razem netto', 'woocommerce' ) .'</th>
          <td data-title=" '. __( 'Razem netto', 'woocommerce' ) .' ">'
          . wc_price( $discount_total - $woocommerce->cart->discount_cart ) .'</td>
          </tr>';
          }


          }






          share|improve this answer








          New contributor




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


















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            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',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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
            });


            }
            });






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










             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53329492%2fwoocommerce-cart-coupon-price-without-tax-to-display%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            I got it, but i want to change the order. I want to move the nett price on top of VAT



            add_action( 'woocommerce_cart_totals_before_order_total', 'bbloomer_wc_discount_total_30', 10, 1 );
            add_action( 'woocommerce_review_order_before_order_total', 'bbloomer_wc_discount_total_30', 10, 1 );
            function bbloomer_wc_discount_total_30() {


            global $woocommerce;

            $discount_total = 0;

            foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values) {

            $_product = $values['data'];

            if ( $_product->get_regular_price() ) {
            $regular_price = $_product->get_regular_price();
            $sale_price = $_product->get_sale_price();
            $discount = ($regular_price - $coupon) ;
            $discount_total += $discount;
            }

            }

            if ( $discount_total > 0 ) {
            echo '<tr class="cart-discount">
            <th>'. __( 'Razem netto', 'woocommerce' ) .'</th>
            <td data-title=" '. __( 'Razem netto', 'woocommerce' ) .' ">'
            . wc_price( $discount_total - $woocommerce->cart->discount_cart ) .'</td>
            </tr>';
            }


            }






            share|improve this answer








            New contributor




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






















              up vote
              0
              down vote













              I got it, but i want to change the order. I want to move the nett price on top of VAT



              add_action( 'woocommerce_cart_totals_before_order_total', 'bbloomer_wc_discount_total_30', 10, 1 );
              add_action( 'woocommerce_review_order_before_order_total', 'bbloomer_wc_discount_total_30', 10, 1 );
              function bbloomer_wc_discount_total_30() {


              global $woocommerce;

              $discount_total = 0;

              foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values) {

              $_product = $values['data'];

              if ( $_product->get_regular_price() ) {
              $regular_price = $_product->get_regular_price();
              $sale_price = $_product->get_sale_price();
              $discount = ($regular_price - $coupon) ;
              $discount_total += $discount;
              }

              }

              if ( $discount_total > 0 ) {
              echo '<tr class="cart-discount">
              <th>'. __( 'Razem netto', 'woocommerce' ) .'</th>
              <td data-title=" '. __( 'Razem netto', 'woocommerce' ) .' ">'
              . wc_price( $discount_total - $woocommerce->cart->discount_cart ) .'</td>
              </tr>';
              }


              }






              share|improve this answer








              New contributor




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




















                up vote
                0
                down vote










                up vote
                0
                down vote









                I got it, but i want to change the order. I want to move the nett price on top of VAT



                add_action( 'woocommerce_cart_totals_before_order_total', 'bbloomer_wc_discount_total_30', 10, 1 );
                add_action( 'woocommerce_review_order_before_order_total', 'bbloomer_wc_discount_total_30', 10, 1 );
                function bbloomer_wc_discount_total_30() {


                global $woocommerce;

                $discount_total = 0;

                foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values) {

                $_product = $values['data'];

                if ( $_product->get_regular_price() ) {
                $regular_price = $_product->get_regular_price();
                $sale_price = $_product->get_sale_price();
                $discount = ($regular_price - $coupon) ;
                $discount_total += $discount;
                }

                }

                if ( $discount_total > 0 ) {
                echo '<tr class="cart-discount">
                <th>'. __( 'Razem netto', 'woocommerce' ) .'</th>
                <td data-title=" '. __( 'Razem netto', 'woocommerce' ) .' ">'
                . wc_price( $discount_total - $woocommerce->cart->discount_cart ) .'</td>
                </tr>';
                }


                }






                share|improve this answer








                New contributor




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









                I got it, but i want to change the order. I want to move the nett price on top of VAT



                add_action( 'woocommerce_cart_totals_before_order_total', 'bbloomer_wc_discount_total_30', 10, 1 );
                add_action( 'woocommerce_review_order_before_order_total', 'bbloomer_wc_discount_total_30', 10, 1 );
                function bbloomer_wc_discount_total_30() {


                global $woocommerce;

                $discount_total = 0;

                foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values) {

                $_product = $values['data'];

                if ( $_product->get_regular_price() ) {
                $regular_price = $_product->get_regular_price();
                $sale_price = $_product->get_sale_price();
                $discount = ($regular_price - $coupon) ;
                $discount_total += $discount;
                }

                }

                if ( $discount_total > 0 ) {
                echo '<tr class="cart-discount">
                <th>'. __( 'Razem netto', 'woocommerce' ) .'</th>
                <td data-title=" '. __( 'Razem netto', 'woocommerce' ) .' ">'
                . wc_price( $discount_total - $woocommerce->cart->discount_cart ) .'</td>
                </tr>';
                }


                }







                share|improve this answer








                New contributor




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









                share|improve this answer



                share|improve this answer






                New contributor




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









                answered 14 mins ago









                Lukasz Beldowski

                1




                1




                New contributor




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





                New contributor





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






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






















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










                     

                    draft saved


                    draft discarded


















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













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












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















                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53329492%2fwoocommerce-cart-coupon-price-without-tax-to-display%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

                    Ottavio Pratesi

                    Tricia Helfer

                    15 giugno