无论如何,使用functions.php内的代码是否有顺序而不是随机的订货号,我知道WooCommerce为此提供了一个插件,但是该插件存在错误和问题,我尝试与他们联系以进行修复,其中之一我收到的错误是以下消息。
WordPress database error Deadlock found when trying to get lock; try restarting transaction for query
INSERT INTO wp_postmeta (post_id,meta_key,meta_value)
SELECT 2209,'_order_number',IF(MAX(CAST(meta_value AS SIGNED)) IS NULL OR MAX(CAST(meta_value AS SIGNED)) < 1000, 1000, MAX(CAST(meta_value AS SIGNED))+1)
FROM wp_postmeta
WHERE meta_key='_order_number' made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), do_action('template_redirect'), WP_Hook->do_action, WP_Hook->apply_filters, WC_AJAX::do_wc_ajax, do_action('wc_ajax_checkout'), WP_Hook->do_action, WP_Hook->apply_filters, WC_AJAX::checkout, WC_Checkout->process_checkout, WC_Checkout->create_order, do_action('woocommerce_checkout_update_order_meta'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Seq_Order_Number_Pro->set_sequential_order_number, WC_Seq_Order_Number_Pro->generate_sequential_order_number
在发生此错误之后,订单将标记为已完成,而不是正在处理,并且该订单内没有产品,并将该产品添加到前一个订单中。
此插件有问题,弄乱了我的数据库。