• Resolved techguysa

    (@techguysa)


    HI there

    Have noticed lets say i get a Order and its total is R11411 (in what ever currency ours is Rand which is R) but if i take the amounts in its actually R11412 but the client then paid the R11411 cause it emailed that amount but 6-9 +/- hours later its self correcting to R11412 which is when i picked up vs to what the customers bank transfer came in and the email sent to me was also R11411 but mathematically was in correct.

    I have noticed one last week which was R10 short but im not entirely sure how many of these were affected and since when. Cause im loosing money without realizing it even if its a small number it adds up maybe a cup of coffee or something but yeah.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @techguysa,

    Thank you for reaching out to us about this issue, this sounds like a serious issue, even though it’s a small amount it still an issue that represents money, so it has to be addressed as soon as possible!

    Can you share more details about this issue? Can you share screenshots of the affected orders before and after? For instance the R11411 order that then became R11412. Please let us know.

    In the meantime, I’d like to understand your site properly. Please share with us the necessary information below for us to investigate the issue further:

    • System Status Report which you can find via WooCommerce > Status > Get system report > Copy for support.
    • Fatal error logs (if any) under WooCommerce > Status > Logs.

    You could copy and paste your reply here or paste it via https://gist.github.com/ and send the link here.

    Once we have more information, we’ll be able to assist you further.

    Thanks!
    -OP

    Thread Starter techguysa

    (@techguysa)

    HI there yes

    when i spot once again will check i have been checking last few days and cant seem to find it replicating so its very intermittently All i got is this of the one im refering to and as im typing this i spotten one which sent the client R5011 but calculates back to R5010

    https://www.techguysa.co.za/wp-content/uploads/2024/04/Totals-issue-woocommerce-April-2024.png
    Emailed from the site
    and what shows later
    https://www.techguysa.co.za/wp-content/uploads/2024/04/Totals-issue-woocommerce-Backend-April-2024.png

    For legal reasons i cant share the customers personal details on the screen shots.

    Site is https://www.techguysa.co.za (WP-admin is hidden just btw)

    Now the only guess is i dont let cents on the site so the site rounds down the sents or up


    Number of decimals set to 0 in woocommerce > settings > General (Tab)

    There is a custom script in functions to display the backend the price with VAT as we dont work like in the states our prices is Vat included so without the script it shows without vat and its hard to tell if the price was correct so instead of checking every time i got the script to display the way its showing on that screen shot was never an issue cause all its doing is adding and such in the admin collums but the total on woocommerce is the issue. so not sure if its the cents in the background doing a round up or down and then correcting itself afterwards?
    Number of decimals set to 0 in woocommerce > settings > General (Tab)

    There is a custom script in functions to display the backend the price with VAT as we dont work like in the states our prices is Vat included so without the script it shows without vat and its hard to tell if the price was correct so instead of checking every time i got the script to display the way its showing on that screen shot was never an issue cause all its doing is adding and such in the admin collums but the total on woocommerce is the issue. so not sure if its the cents in the background doing a round up or down and then correcting itself afterwards?

    The script that i am using in functions if this helps are

    
    add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2);
    function wcs_custom_get_availability( $availability, $_product ) {
        
        // Change In Stock Text
        if ( $_product->is_in_stock() ) {
            $availability['availability'] = __('In stock with Supplier', 'woocommerce');
        }
        // Change Out of Stock Text
        if ( ! $_product->is_in_stock() ) {
            $availability['availability'] = __('Supplier out of stock', 'woocommerce');
        }
    	// Change Available on backorder Text
        if ( $_product->is_on_backorder() ) {
            $availability['availability'] = __('Available on Backorder / Request', 'woocommerce');
        }
    	
        return $availability;
    }
    
    add_action( 'woocommerce_admin_order_item_values', 'action_woocommerce_admin_order_item_values', 10, 3 );
      function action_woocommerce_admin_order_item_values( $null, $item, $item_id ) {
        $validOrderItemTypes = ['line_item', 'shipping', 'fee'];
        $val = ( in_array( $item['type'], $validOrderItemTypes )) ? $item['total'] + $item['total_tax'] : '−';
        $price = wc_price( $val );
        ?>
        <td class="item_fcost" data-sort-value="<?php echo $val; ?>">
            <div class="view" style="font-weight: bold; text-align: right; padding-right: 10px;">
                <?php echo $price; ?>
            </div>
        </td>
        <?php
    };
    
    add_action( 'woocommerce_admin_order_item_headers', 'action_woocommerce_admin_order_item_headers', 10, 3 );
    function action_woocommerce_admin_order_item_headers( $order ) {
        echo '<th class="item_fcost sortable" data-sort="float" style="text-align: right;">Price incl. VAT</th>';
    }
    function es_add_cart_notice() {
        // Only on cart and check out pages
        if( ! ( is_cart() || is_checkout() ) ) return;
        
        // Set message
        $message = "You have a Backorder / Requested product in your cart.";
        
        // Set variable
        $found = false;
        
        // Loop through all products in the Cart        
        foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
            // Get an instance of the WC_Product object
            $product = $cart_item['data'];
    
            // Product on backorder
            if( $product->is_on_backorder() ) {
                $found = true;
                break;
            }
        }
    
        // true
        if ( $found ) {
            wc_add_notice( __( $message, 'woocommerce' ), 'notice' );
            
            // Removing the proceed button, until the condition is met
            // optional
            // remove_action( 'woocommerce_proceed_to_checkout','woocommerce_button_proceed_to_checkout', 20);
        }
    
    }
    add_action( 'woocommerce_check_cart_items', 'es_add_cart_notice', 10, 0 );
    
    add_filter('woocommerce_short_description','ts_add_text_short_descr');
    function ts_add_text_short_descr($description){
      $text="<b>Notice:</b> 2% off when paying via EFT at checkout.";
      return $description.$text;
    }

    The one im using for the backend vat is

    
    add_action( 'woocommerce_admin_order_item_headers', 'action_woocommerce_admin_order_item_headers', 10, 3 );
    function action_woocommerce_admin_order_item_headers( $order ) {
        echo '<th class="item_fcost sortable" data-sort="float" style="text-align: right;">Price incl. VAT</th>';
    }

    If this information helps

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @techguysa,

    Thanks for sharing further details.

    It seems like the issue could be related to the rounding of the prices due to the number of decimals set to 0 in WooCommerce settings, as you’ve suspected. This might be causing the system to round down or up and then correct itself later, resulting in a discrepancy.

    The custom script you’re using to show the price with VAT included in the backend could also contribute to the issue. However, it’s hard to determine the exact cause without a deeper investigation.

    I would recommend you to try the following steps to troubleshoot this issue:

    1. Temporarily disable the custom script to see if the issue persists. If the discrepancy disappears, the issue might be related to the custom script.
    2. If the issue persists even after disabling the custom script, try changing the number of decimals from 0 to 2, then check if the discrepancy still exists.
    3. If none of the above steps help, there might be a conflict with another plugin or theme. Try deactivating all other plugins and switching to a default WordPress theme like Storefront to see if the issue persists.

    Please remember to back up your site before making any changes.

    Once you’ve tried these steps, please let us know the results. If the issue persists, we’ll need to investigate further.

    Thread Starter techguysa

    (@techguysa)

    mm looks like a weekend testing will be done.

    Will let you know not found of chaning decimals to 2 etc
    again will let you know

    I do see an update will run that later as well

    Hey, @techguysa!

    All right! You can take your time, we will be here when you are done.

    In the meantime, please feel free to reach out if you have any questions.

    Have a wonderful day!

    Plugin Support omarfpg a11n

    (@omarfpg)

    Hi there ?? ,

    We haven’t heard from you in a while; this is to check if you’ve been able to proceed with the troubleshooting steps provided before and if you still need help.

    Thanks!
    -OP

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Totals miss calculating’ is closed to new replies.