• Hello,

    I have a problem with the numbering of my invoices. For some time, when orders are entering my online store, only terminations with even numbers appear, skipping odd numbers. Is this error due to? Could you help me? I am having a lot of billing problems for this.

    https://www.screencast.com/t/B0jIDssr07Zs

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor kluver

    (@kluver)

    Hi @naiararomm,

    That is unfortunate. There are several reasons why this could have happened. If you could answer the following questions we can zone in on the possible problem.

    1) Are you using our Professional extension and are you creating Proforma invoices that follow the main invoice numbering sequence?

    2) If this is not the case or if you are unsure can you add the following code snippet to the functions.php of your child theme:

    add_action( 'wpo_wcpdf_after_settings_page', 'wcpdf_invoice_number_store_debug_tools', 9, 2 );
    function wcpdf_invoice_number_store_debug_tools( $tab, $section ){
    	global $wpdb;
    	if ($tab !== 'debug') {
    		return;
    	}
    	$store_name = "invoice_number";
    	$table_name = "{$wpdb->prefix}wcpdf_{$store_name}"; // i.e. wp_wcpdf_invoice_number
    	$results = $wpdb->get_results( "SELECT * FROM {$table_name}" );
    	echo "<h1>Invoice Numbers</h1><table>";
    	echo "<tr><th>invoice number</th><th>order ID</th><th>order date</th><th>status</th></tr>";
    	foreach ($results as $result) {
    		$order = wc_get_order( $result->order_id );
    		$status = !empty($order) ? $order->get_status() : '?';
    		if ( in_array( $status, ['trash', 'cancelled', '?'] ) ) {
    			$status = "<strong>{$status}</strong>";
    		}
    		$url = sprintf('post.php?post=%s&action=edit', $result->order_id);
    		$link = sprintf('<a href="%s">%s</a>', $url, $result->order_id);
    		printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>", $result->id, $link, $result->date, $status);
    	}
    	echo '</table>';
    }

    If you have never worked with code snippets or functions.php before please read this: How to use filters

    This code snippet will add a list to WooCommerce > PDF Invoices > Status that will show you recent invoice numbers and to which order they were assigned and at what time. This might clear up where the “lost” invoice numbers have gone.

    3) If this does’t clear things up a final possibility could be that a so called ‘race condition’ occurred. This happens when two invoices are created at exactly the same time. This is sometimes related to the used payment gateway. Can you tell us what the payment methods were for the specific orders you show in your screenshot?

    Thank you in advance!

    • This reply was modified 5 years, 6 months ago by kluver.
    Thread Starter Naiara Mooy

    (@naiararomm)

    hello again and thanks for your reply.

    I have inserted the code that you have given me and the list appears. But the problem persists.

    I have also observed in the ‘Status’ table that this option exists that I think is related to my problem. But it still doesn’t work. https://www.screencast.com/t/UBWQh7Ywm1T

    If I manually enter the corresponding odd number, as soon as an order comes back that number that I have placed, it puts it correctly, but if I look again, the next number that appears for the next order that enters again to skip a number.

    I have the free version.

    If you can think of another solution here I listen to you.

    Thanks again.

    Plugin Contributor Ewout

    (@pomegranate)

    Hello Naiara,
    Are the odd numbers not mentioned at all in the list on the Status tab? In that case it would indeed be related to that “calculate document numbers” setting.
    If you could share a screenshot of that list it may help us in debugging this too.

    Plugin Contributor Ewout

    (@pomegranate)

    We have found a regression bug that was introduced in version 2.3.2 that caused duplicate invoice numbers when multiple emails (sent in the same session) were set to receive the invoice attachment. Could you check the latest version released today (2.3.4) to see if that indeed resolves the issue?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘ERROR IN INVOICE NUMBERS’ is closed to new replies.