• Hello, thank you for the good plugin. It seems to work very well until it started to skip the numbers of the invoice. For examle after invoice No.60 the thext will be No.62. Where is the problem?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    There are various possible reasons a number is ‘missing’, mostly they have been assigned to other/older orders by accident, or consumed to create a proforma invoice or credit note (only if you have the Professional extension and set these documents to use the main invoice number sequence, the default is to use separate sequences). It’s also possible that your orders are being confirmed twice in parallel, in which case not only are two invoices created for one order, the customer also receives the email twice and stock is reduced twice as well.
    Are these orders paid via PayPal? If so, check this thread: Bug: skipped invoice numbers

    Thread Starter leedu01

    (@leedu01)

    The orders payment method was made by Stripe. I do not imagine what is wrong. Can I give you access to the dashboard to let you check this?

    Plugin Contributor kluver

    (@kluver)

    Hi @leedu01,

    Before giving us access it might be a good idea to implement the following code snippet:

    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>';
    }

    This will add a list of the most current invoice numbers, the order id to which they belong and the date they were created to the Status tab (WooCommerce > PDF Invoices > Status). Maybe this might give you some insight in what might have happened.

    You can add this code snippet to the functions.php of your child theme or with a plugin like Code Snippets. If you haven’t worked with code snippets or functions.php before please read this: How to use filters

    • This reply was modified 6 years, 7 months ago by kluver.
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Next invoice number’ is closed to new replies.