{"id":19036928,"date":"2026-10-05T15:30:02","date_gmt":"2026-10-05T15:30:02","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/bulk-edit-affecting-order-data\/"},"modified":"2026-10-05T15:30:02","modified_gmt":"2026-10-05T15:30:02","slug":"bulk-edit-affecting-order-data","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/bulk-edit-affecting-order-data\/","title":{"rendered":"Bulk Edit affecting order data"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Bulk packing slip generation via the admin orders list is followed, approximately two seconds later, by line-item data loss on one or more of the orders included in that batch. Affected line items have <code>_product_id<\/code>, <code>_qty<\/code>, <code>_line_subtotal<\/code>, <code>_line_total<\/code> and <code>_line_tax<\/code> set to <code>0<\/code>, while plugin-added meta on the same rows survives intact.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Single-order document generation does <strong>not<\/strong> reproduce it. Orders with nine separate single-order generations are unaffected.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Approximate rate: 1\u20132 orders corrupted per 20-order batch (~5\u20137%).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Reproduction \u2014 three consecutive occurrences in seven minutes<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">All three bulk requests came from the same admin session on 5 October 2026. Corruption timestamps are from a <code>BEFORE UPDATE<\/code> trigger on <code>wp_woocommerce_order_itemmeta<\/code> that records the previous value. Bulk request (UTC)Orders in requestCorruptedCorruption logged09:04:008 orders (144256\u2013144270)144267, 14427009:04:0209:07:5820 orders (144271\u2013144310)14429409:08:0009:11:0620 orders (144311\u2013144351)144325, 14432609:11:08<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example request:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GET \/wp-admin\/admin-ajax.php?action=generate_wpo_wcpdf\n    &amp;document_type=packing-slip&amp;bulk&amp;_wpnonce=b31dacf513\n    &amp;order_ids=144270x144269x144268x144267x144266x144265x144264x144256\nHTTP\/1.1  200  3278415\nReferer: \/wp-admin\/admin.php?page=wc-orders&amp;status=wc-processing&amp;paged=4<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Every corrupted order appeared in the <code>order_ids<\/code> of the request two seconds earlier. No order outside those batches was affected. Damage signature<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Two distinct patterns have been observed, both following bulk generation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Pattern A: fields zeroed<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Zeroed: <code>_product_id<\/code>, <code>_qty<\/code>, <code>_line_subtotal<\/code>, <code>_line_total<\/code>, <code>_line_tax<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Survive: <code>order_item_name<\/code>, <code>_reduced_stock<\/code>, <code>_wc_cog_item_cost<\/code>, <code>_wc_cog_item_total_cost<\/code>, <code>_wcpdf_regular_price<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>_line_tax_data<\/code> becomes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a:2:{s:5:\"total\";a:0:{}s:8:\"subtotal\";a:0:{}}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That is, <strong>empty arrays<\/strong> \u2014 not a rate ID with a zero value. A legitimately zero-priced line on the same order (a BOGO free gift) stores:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a:2:{s:5:\"total\";a:1:{i:1;s:1:\"0\";}s:8:\"subtotal\";a:1:{i:1;s:1:\"0\";}}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The emptied tax structure plus the exact set of affected fields suggests a default-constructed <code>WC_Order_Item_Product<\/code> being saved over an existing row, rather than a recalculation producing zeros.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In one case (<code>order_item_id<\/code> 385202, order 144294) even <code>order_item_name<\/code> was emptied.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Pattern B \u2014 <code>_reduced_stock<\/code> deleted<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Order 144256, also in the 09:04 batch, kept its product IDs and quantities but had <code>_reduced_stock<\/code> <strong>deleted<\/strong> from all 14 line items. A <code>BEFORE DELETE<\/code> trigger captured the removals.<\/p>\n","protected":false},"template":"","class_list":["post-19036928","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19036928","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19036928\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=19036928"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}