woocommerce / woocommerce

A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
https://woocommerce.com
9.3k stars 10.74k forks source link

Order meta data incorrectly deleted when in HPOS compatibility mode #44102

Closed secureitgunstorage closed 7 months ago

secureitgunstorage commented 7 months ago

Prerequisites

Describe the bug

When configuring a store to use HPOS with compatibility mode enabled and High-performance order storage as the selected storage type, an issue exists with syncing meta data.

Meta data that is added via 'update_post_meta' is not synced if 'update_post_meta' is called via the 'woocommerce_checkout_order_processed' hook.

Expected behavior

Order meta data is synced between legacy and HPOS tables

Actual behavior

Meta data is deleted from 'wp_postmeta' by the 'update_order_meta_from_object' Helper method

Steps to reproduce

  1. Enable HPOS
  2. Enable HPOS compatibility mode
  3. Set datastore to High-performance order storage
  4. Add the following snippet to your theme functions.php
add_action( 'woocommerce_checkout_order_processed', 'test_woocommerce_checkout_order_processed_action', 10, 3 );    
function test_woocommerce_checkout_order_processed_action( $order_id, $posted_data, $order ){
    update_post_meta( $order_id, '_hpos_bug_tracker', 'HERE' );
}
  1. Place an order

WordPress Environment

`

WordPress Environment

WordPress address (URL): https://gun-site-merge-test.local Site address (URL): https://gun-site-merge-test.local WC Version: 8.5.2 REST API Version: ✔ 8.5.2 WC Blocks Version: ✔ 11.8.0-dev Action Scheduler Version: ✔ 3.7.1 Log Directory Writable: ✔ WP Version: ❌ 6.3.2 - There is a newer version of WordPress available (6.4.2) WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ✔ Language: en_US External object cache: –

Server Environment

Server Info: nginx/1.16.0 PHP Version: 8.2.10 PHP Post Max Size: 1,000 MB PHP Time Limit: 1200 PHP Max Input Vars: 4000 cURL Version: 7.85.0 (SecureTransport) LibreSSL/3.3.6

SUHOSIN Installed: – MySQL Version: 8.0.16 Max Upload Size: 300 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔

Database

WC Database Version: 8.5.2 WC Database Prefix: wp_ Total Database Size: 6243.44MB Database Data Size: 3688.53MB Database Index Size: 2554.91MB wp_woocommerce_sessions: Data: 1.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_items: Data: 39.58MB + Index: 15.55MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 1588.00MB + Index: 454.86MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.06MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Data: 0.08MB + Index: 0.14MB + Engine InnoDB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_payment_tokenmeta: Data: 0.05MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB _mig_queue_failures: Data: 0.02MB + Index: 0.00MB + Engine InnoDB _mig_queue_jobs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB _mig_wpmdb_alter_statements: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_actionscheduler_actions: Data: 2.13MB + Index: 0.95MB + Engine InnoDB wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Data: 1.38MB + Index: 0.41MB + Engine InnoDB wp_adtribes_my_conversions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_automatewoo_abandoned_carts: Data: 3.52MB + Index: 0.08MB + Engine InnoDB wp_automatewoo_customer_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_automatewoo_customers: Data: 6.52MB + Index: 16.09MB + Engine InnoDB wp_automatewoo_events: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_automatewoo_guest_meta: Data: 14.55MB + Index: 20.03MB + Engine InnoDB wp_automatewoo_guests: Data: 4.52MB + Index: 8.06MB + Engine InnoDB wp_automatewoo_log_meta: Data: 36.58MB + Index: 33.11MB + Engine InnoDB wp_automatewoo_logs: Data: 5.52MB + Index: 8.55MB + Engine InnoDB wp_automatewoo_queue: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_automatewoo_queue_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_berocket_termmeta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_bv_dynamic_sync: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_bv_ip_store: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_cardinal_locator_coords: Data: 0.02MB + Index: 0.13MB + Engine InnoDB wp_cartflows_visits: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_cartflows_visits_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_cf7_vdata: Data: 0.31MB + Index: 0.00MB + Engine InnoDB wp_cf7_vdata_entry: Data: 11.52MB + Index: 0.00MB + Engine InnoDB wp_cleantalk_ac_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_cleantalk_no_cookie_data: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_cleantalk_sessions: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_cleantalk_sfw: Data: 1.52MB + Index: 0.48MB + Engine InnoDB wp_cleantalk_sfw_logs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_cleantalk_spamscan_logs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_cleantalk_ua_bl: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_commentmeta: Data: 1.52MB + Index: 0.64MB + Engine InnoDB wp_comments: Data: 130.67MB + Index: 101.33MB + Engine InnoDB wp_cr_local_forms: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_db7_forms: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_e_events: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_e_notes: Data: 0.02MB + Index: 0.17MB + Engine InnoDB wp_e_notes_users_relations: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_e_submissions: Data: 0.02MB + Index: 0.27MB + Engine InnoDB wp_e_submissions_actions_log: Data: 0.02MB + Index: 0.11MB + Engine InnoDB wp_e_submissions_values: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_facetwp_index: Data: 0.05MB + Index: 0.05MB + Engine InnoDB wp_failed_jobs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_followup_coupon_logs: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_followup_coupons: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_followup_customer_carts: Data: 0.05MB + Index: 0.03MB + Engine InnoDB wp_followup_customer_notes: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_followup_customer_orders: Data: 0.44MB + Index: 0.33MB + Engine InnoDB wp_followup_customers: Data: 0.48MB + Index: 0.91MB + Engine InnoDB wp_followup_email_coupons: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_followup_email_excludes: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_followup_email_logs: Data: 2.52MB + Index: 0.97MB + Engine InnoDB wp_followup_email_order_coupons: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_followup_email_orders: Data: 6.52MB + Index: 3.13MB + Engine InnoDB wp_followup_email_tracking: Data: 1.52MB + Index: 1.20MB + Engine InnoDB wp_followup_followup_history: Data: 1.52MB + Index: 0.05MB + Engine InnoDB wp_followup_order_categories: Data: 1.52MB + Index: 3.03MB + Engine InnoDB wp_followup_order_items: Data: 1.52MB + Index: 2.39MB + Engine InnoDB wp_followup_subscriber_lists: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_followup_subscribers: Data: 0.09MB + Index: 0.13MB + Engine InnoDB wp_followup_subscribers_to_lists: Data: 0.08MB + Index: 0.09MB + Engine InnoDB wp_icwp_wpsf_audit_trail: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_icwp_wpsf_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_icwp_wpsf_geoip: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_icwp_wpsf_ip_lists: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_icwp_wpsf_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_icwp_wpsf_reports: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_icwp_wpsf_sessions: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_icwp_wpsf_traffic: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_lhr_log: Data: 7.52MB + Index: 0.00MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_litespeed_img_optm: Data: 2.52MB + Index: 0.83MB + Engine InnoDB wp_litespeed_img_optming: Data: 0.05MB + Index: 0.05MB + Engine InnoDB wp_mailchimp_carts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailchimp_jobs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mclean_refs: Data: 0.25MB + Index: 0.00MB + Engine InnoDB wp_mclean_scan: Data: 0.09MB + Index: 0.02MB + Engine InnoDB wp_mo2f_network_blocked_ips: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mo2f_network_email_sent_audit: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mo2f_network_transactions: Data: 0.11MB + Index: 0.00MB + Engine InnoDB wp_mo2f_network_whitelisted_ips: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mo2f_user_details: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mo2f_user_login_info: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_options: Data: 11.50MB + Index: 0.52MB + Engine InnoDB wp_pmxe_exports: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxe_google_cats: Data: 0.39MB + Index: 0.00MB + Engine InnoDB wp_pmxe_posts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxe_templates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_files: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_hash: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_history: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_images: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_imports: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_posts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_templates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_popup_analytics: Data: 348.91MB + Index: 0.00MB + Engine InnoDB wp_postmeta: Data: 579.00MB + Index: 586.00MB + Engine InnoDB wp_posts: Data: 79.56MB + Index: 22.61MB + Engine InnoDB wp_pum_subscribers: Data: 5.52MB + Index: 2.33MB + Engine InnoDB wp_pys_stat_landing: Data: 0.08MB + Index: 0.00MB + Engine InnoDB wp_pys_stat_order: Data: 0.44MB + Index: 0.00MB + Engine InnoDB wp_pys_stat_product_order: Data: 3.52MB + Index: 0.00MB + Engine InnoDB wp_pys_stat_traffic: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pys_stat_utm_campaing: Data: 0.06MB + Index: 0.00MB + Engine InnoDB wp_pys_stat_utm_content: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pys_stat_utm_medium: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pys_stat_utm_source: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pys_stat_utm_term: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_queue: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_redirection_404: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_redirection_groups: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_redirection_items: Data: 0.22MB + Index: 0.25MB + Engine InnoDB wp_redirection_logs: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_revslider_css: Data: 0.14MB + Index: 0.00MB + Engine InnoDB wp_revslider_layer_animations: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_revslider_navigations: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_revslider_sliders: Data: 0.05MB + Index: 0.00MB + Engine InnoDB wp_revslider_slides: Data: 0.23MB + Index: 0.00MB + Engine InnoDB wp_revslider_static_slides: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_search_filter_cache: Data: 0.11MB + Index: 0.17MB + Engine InnoDB wp_search_filter_term_results: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_searchwp_index: Data: 6.52MB + Index: 15.06MB + Engine InnoDB wp_searchwp_log: Data: 8.52MB + Index: 12.55MB + Engine InnoDB wp_searchwp_status: Data: 0.28MB + Index: 0.42MB + Engine InnoDB wp_searchwp_tokens: Data: 1.52MB + Index: 4.55MB + Engine InnoDB wp_simple_history: Data: 1.52MB + Index: 0.31MB + Engine InnoDB wp_simple_history_contexts: Data: 2.52MB + Index: 3.03MB + Engine InnoDB wp_smush_dir_images: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_swp_analytics: Data: 8.52MB + Index: 0.00MB + Engine InnoDB wp_taxjar_record_queue: Data: 4.52MB + Index: 2.52MB + Engine InnoDB wp_term_relationships: Data: 1.52MB + Index: 1.52MB + Engine InnoDB wp_term_taxonomy: Data: 0.05MB + Index: 0.03MB + Engine InnoDB wp_termmeta: Data: 0.11MB + Index: 0.11MB + Engine InnoDB wp_terms: Data: 0.05MB + Index: 0.03MB + Engine InnoDB wp_tg_item_elements: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_tg_item_skins: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 135.67MB + Index: 125.33MB + Engine InnoDB wp_users: Data: 6.52MB + Index: 7.55MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB wp_wc_avatax_tax_codes: Data: 0.34MB + Index: 0.00MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 5.52MB + Index: 4.03MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_gpf_render_cache: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_order_addresses: Data: 22.56MB + Index: 27.06MB + Engine InnoDB wp_wc_order_bundle_lookup: Data: 16.55MB + Index: 26.09MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 1.52MB + Index: 3.03MB + Engine InnoDB wp_wc_order_operational_data: Data: 15.55MB + Index: 9.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 36.58MB + Index: 38.09MB + Engine InnoDB wp_wc_order_stats: Data: 7.52MB + Index: 6.55MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 2.52MB + Index: 3.03MB + Engine InnoDB wp_wc_orders: Data: 28.56MB + Index: 29.61MB + Engine InnoDB wp_wc_orders_meta: Data: 441.00MB + Index: 938.94MB + Engine InnoDB wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.05MB + Index: 0.09MB + Engine InnoDB wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_zapier_history: Data: 1.52MB + Index: 0.20MB + Engine InnoDB wp_wcf_filters: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wcf_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wcf_index: Data: 0.14MB + Index: 0.17MB + Engine InnoDB wp_wdr_order_discounts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wdr_order_item_discounts: Data: 6.52MB + Index: 5.55MB + Engine InnoDB wp_wdr_rules: Data: 0.19MB + Index: 0.00MB + Engine InnoDB wp_webarx_event_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_webarx_firewall_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_webarx_logic: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfblockediplog: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfblocks7: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfconfig: Data: 0.50MB + Index: 0.00MB + Engine InnoDB wp_wfcrawlers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wffilechanges: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wffilemods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfhits: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfhoover: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfissues: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wfknownfilelist: Data: 2.52MB + Index: 0.00MB + Engine InnoDB wp_wflivetraffichuman: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wflocs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wflogins: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wfls_2fa_secrets: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfls_settings: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfnotifications: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfpendingissues: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wfreversecache: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfsnipcache: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfstatus: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wftrafficrates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wishsuite_list: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woo_shippment_provider: Data: 0.14MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_bundled_itemmeta: Data: 0.39MB + Index: 0.52MB + Engine InnoDB wp_woocommerce_bundled_items: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_exported_csv_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_gc_activity: Data: 0.06MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_gc_cards: Data: 0.06MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_gc_cardsmeta: Data: 0.06MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_gpf_google_taxonomy: Data: 1.52MB + Index: 0.13MB + Engine InnoDB wp_woocommerce_shipping_table_rates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_shipping_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woof_sd: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woof_sd_presets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpfm_backup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpforms_entries: Data: 1.52MB + Index: 0.05MB + Engine InnoDB wp_wpforms_entry_fields: Data: 1.52MB + Index: 0.53MB + Engine InnoDB wp_wpforms_entry_meta: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wpforms_logs: Data: 3.52MB + Index: 0.00MB + Engine InnoDB wp_wpforms_payment_meta: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wpforms_payments: Data: 0.02MB + Index: 0.14MB + Engine InnoDB wp_wpforms_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpmailsmtp_debug_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpmerge_options: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wpns_attack_logs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpns_backup_report: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpns_files_scan: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wpns_ip_rate_details: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpns_malware_hash_file: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wpns_malware_scan_report: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpns_malware_scan_report_details: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpns_malware_skip_files: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpr_rocket_cache: Data: 0.16MB + Index: 0.16MB + Engine InnoDB wp_wpr_rucss_used_css: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_yith_wcan_filter_sessions: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_yoast_indexable: Data: 0.39MB + Index: 0.16MB + Engine InnoDB wp_yoast_indexable_hierarchy: Data: 0.05MB + Index: 0.05MB + Engine InnoDB wp_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_yoast_primary_term: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_yoast_seo_links: Data: 0.38MB + Index: 0.25MB + Engine InnoDB wp_yoast_seo_meta: Data: 2.52MB + Index: 0.00MB + Engine InnoDB

Post Type Counts

acf-field: 34 acf-field-group: 6 acf-ui-options-page: 1 acoplw_badges: 23 acoplw_prod_list: 5 aiosrs-schema: 1 attachment: 3211 aw_workflow: 4 bh_sl_locations: 41 custom_css: 1 elementor_font: 6 elementor_library: 121 follow_up_email: 8 nav_menu_item: 140 oembed_cache: 149 page: 99 popup: 6 popup_theme: 5 post: 111 product: 126 product_variation: 71 revision: 2 search-filter-widget: 2 secureit_resources: 11 secureit_testimonial: 10 seedprod: 2 shop_coupon: 6387 shop_order: 86009 shop_order_refund: 3462 the_grid: 1 wc_order_status: 10 wc_voucher: 256 wc_voucher_template: 1 woo_discount: 5 woolentor-template: 3 wp_global_styles: 1 wp-rest-api-log: 12 wpcode: 2 wpforms: 9

Security

Secure connection (HTTPS): ✔ Hide errors from visitors: ✔

Active Plugins (1)

WooCommerce: by Automattic – 8.5.2

Inactive Plugins (66)

Acowebs Product Labels For Woocommerce Pro: by Acowebs – 3.2.10 Advanced Custom Fields PRO: by WP Engine – 6.2.4 Advanced Database Cleaner PRO: by Younes JFR. – 3.2.3 Advanced Shipment Tracking Pro: by zorem – 3.1 Akismet Anti-spam: Spam Protection: by Automattic - Anti-spam Team – 5.3 Avalara AvaTax: by Avalara – 2.6.1 (update to version 2.7.0 is available) Category Order and Taxonomy Terms Order: by Nsp-Code – 1.8 Customer Reviews for WooCommerce: by CusRev – 5.38.8 Disable Cart Fragments: by Optimocha – 2.3 Drip for WooCommerce: by Drip – 1.1.7 Duplicate Page: by mndpsingh287 – 4.5.3 Elementor: by Elementor.com – 3.18.3 Elementor Pro: by Elementor.com – 3.18.2 FacetWP: by FacetWP LLC – 4.2.8

FacetWP - Elementor: by FacetWP LLC – 1.9

FiboSearch - AJAX Search for WooCommerce: by FiboSearch Team – 1.26.1 GTM4WP: by Thomas Geiger – 1.19.1 Lazy Load - Optimize Images: by WP Rocket – 2.3.6 Mailgun: by Mailgun – 1.9.6 Metorik Helper: by Metorik – 1.7.1 Payment Plugins for Stripe WooCommerce: by Payment Plugins support@paymentplugins.com – 3.3.55

QuadMenu: by QuadLayers – 3.1.0 QuadMenu PRO: by QuadLayers – 3.0.9 Redirection: by John Godley – 5.4.1 REST API Log: by Pete Nelson – 1.7.0 Route App: by Route – 2.2.7 Safe SVG: by 10up – 2.2.2 Schema Pro: by Brainstorm Force – 2.7.13 Search & Filter Pro: by Code Amp – 2.5.16 SearchWP: by SearchWP – 4.3.9 SearchWP Custom Results Order: by SearchWP – 1.3.6 SecureIt Empty Cart: by Jeremy Hilton - SecureIt – 1.0 SecureIt Site Customizer: by Jeremy Hilton – 0.2.6 ShopLentor Pro – WooCommerce Builder for Elementor & Gutenberg: by HasThemes – 2.3.2 ShopLentor – WooCommerce Builder for Elementor & Gutenberg: by HasThemes – 2.7.7 Simple History: by Pär Thernström – 4.9.0 Simple Login Notification: by Jeff Starr – 1.6 SSL Insecure Content Fixer: by WebAware – 2.7.2 Store Toolkit for WooCommerce: by Visser Labs – 2.3.10 Stripe Invoicing Extension: by Jeremy Hilton – 0.1.0 Ultimate Addons for Elementor: by Brainstorm Force – 1.36.28 WooCommerce Checkout Field Editor: by WooCommerce – 1.7.12 WooCommerce Cost of Goods: by SkyVerge – 2.13.0 WooCommerce Customer/Order/Coupon Export: by SkyVerge – 5.5.0 WooCommerce Google Product Feed: by Ademti Software Ltd. – 10.11.4 (update to version 10.12.2 is available) WooCommerce Help Scout: by WooCommerce – 3.9.2 WooCommerce Order Status Manager: by SkyVerge – 1.15.2 WooCommerce PayPal Payments: by WooCommerce – 2.4.3 (update to version 2.5.1 is available) WooCommerce Product Bundles: by WooCommerce – 6.22.5 (update to version 6.22.6 is available) WooCommerce Sequential Order Numbers Pro: by SkyVerge – 1.20.3 (update to version 1.21.0 is available) WooCommerce ShipperHQ: by ShipperHQ – 1.6.2 WooCommerce Smart Coupons: by StoreApps – 8.12.0 (update to version 8.14.0 is available) WooCommerce Wholesale Prices: by Rymera Web Co – 2.1.10.1 WooCommerce Wholesale Prices Premium: by Rymera Web Co – 1.30.4 WooCommerce Zapier: by OM4 Software – 2.9.1 (update to version 2.10.0 is available) Woo Discount Rules: by Flycart – 2.6.2 Woo Discount Rules PRO 2.0: by Flycart – 2.6.1 Woo Gift Cards: by Woo – 1.16.8 (update to version 1.16.9 is available) WP Engine Smart Plugin Manager: by WP Engine – 5.3.1 WPForms: by WPForms – 1.8.6 WP Rocket: by WP Media – 3.14.4.2 WP Rollback: by WP Rollback – 2.0.5 YITH WooCommerce Added to Cart Popup Premium: by YITH – 2.14.0 YITH WooCommerce Customize My Account Page Premium: by YITH – 4.4.0 Yoast SEO: by Team Yoast – 21.8 Yotpo Social Reviews for Woocommerce: by Yotpo – 1.6.6

Dropin Plugins (1)

advanced-cache.php: advanced-cache.php

Must Use Plugins (2)

SecureIt Error Reporting: by – SecureIt Performance Booster: by –

Settings

API Enabled: ✔ Force SSL: ✔ Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: bundle (bundle) external (external) grouped (grouped) simple (simple) variable (variable)

Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) exclude-from-search (exclude-from-search-2) featured (featured) featured (featured-2) outofstock (outofstock) rated-1 (rated-1) rated-1 (rated-1-2) rated-2 (rated-2) rated-2 (rated-2-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) rated-5 (rated-5-2)

Connected to Woo.com: ✔ Enforce Approved Product Download Directories: – HPOS feature screen enabled: ✔ HPOS feature enabled: ✔ Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore HPOS data sync enabled: ✔

WC Pages

Shop base: #5 - /gun-storage-products/ Cart: #6 - /cart/ Checkout: #7 - /checkout/ My account: #8 - /my-account/ Terms and conditions: #176295 - /terms-and-conditions/

Theme

Name: Storefront Version: 4.5.4 Author URL: https://woo.com/ Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ✔

Templates

Overrides: –

Admin

Enabled Features: activity-panels analytics product-block-editor coupons core-profiler customer-effort-score-tracks import-products-task experimental-fashion-sample-products shipping-smart-defaults shipping-setting-tour homescreen marketing mobile-app-banner navigation onboarding onboarding-tasks product-variation-management product-virtual-downloadable product-external-affiliate product-grouped remote-inbox-notifications remote-free-extensions payment-gateway-suggestions shipping-label-banner subscriptions store-alerts transient-notices woo-mobile-welcome wc-pay-promotion wc-pay-welcome-page

Disabled Features: customize-store minified-js new-product-management-experience product-linked settings async-product-editor-category-field

Daily Cron: ✔ Next scheduled: 2024-01-26 08:33:51 -05:00 Options: ✔ Notes: 74 Onboarding: completed

Action Scheduler

Complete: 2,538 Oldest: 2023-12-25 18:06:57 -0500 Newest: 2024-01-25 16:05:57 -0500

Failed: 5 Oldest: 2023-12-28 13:04:54 -0500 Newest: 2024-01-25 15:58:46 -0500

In-progress: 1 Oldest: – Newest: –

Pending: 25 Oldest: 2024-01-25 16:05:35 -0500 Newest: 2024-01-26 12:30:03 -0500

Status report information

Generated at: 2024-01-25 16:06:02 -05:00 `

Isolating the problem

jorgeatorres commented 7 months ago

Hi @secureitgunstorage!

Thanks for reaching out. This is indeed intentional as HPOS orders are no longer regular posts To fetch/update metadata you should rely on CRUD functions as described in our upgrade guide, which would work both when HPOS is the selected datastore and when posts is.

Given the hook you're using already provides $order you could just do $order->update_meta_data() instead of update_post_meta().

Now, as for the "intentional" part: when HPOS is selected as datastore it is considered the "source of truth" and so updates made to the post are not reflected in the HPOS order (but the other way around). Otherwise, we wouldn't be able to tell whether that metadata is just out of date (and should be removed) or should indeed be incorporated into the order.

Based on the above I'm going to close this issue, but feel free to reopen if I have missed or misinterpreted something.

secureitgunstorage commented 7 months ago

Thanks for the information.

In the docs, it clearly states:

It is important to keep the sync in place until all plugins and custom code are compatible with the new HPOS. Any performance penalties will be temporary, resulting from additional inserts present during the sync.

and

Additionally, you can switch from using HPOS to posts tables manually if you see an issue with the new tables.

That second statement, while true, gives store owners a false sense of security. In reality, compatibility mode is really only useful of you are using the posts tables as the order datastore. IMO this is not clear from the docs.

The recommendation that we instead use CRUD operations makes sense -- for code that originates from our team. However, it assumes that all vendor plugins are using CRUD. If a vendor fails to appropriately use CRUD, store owners will encounter issues with orders that stem from data not being saved to orders. This is an exact scenario that bit us recently.

A plugin from your extensions store which declared itself as HPOS compatible was not using the CRUD operations despite us selecting HPOS as the order datastore. They coded a check for the OrderUtil class incorrectly and that check is always returning false.

class_exists('OrderUtil')

Their routines then fall back to using the posts table datastore.

This has resulted in the following behavior:

Customer completes an order. The non-compliant (or in our case buggy) plugin does not save critical order information to the HPOS tables because those CRUD operations are never executed. Data is however stored in the posts table. WooCommerce then compares the order data in the HPOS datastore to the data in the Posts datastore, sees that there is a difference and deletes the posts table entries which are now lost to the store owner. This only manifests itself through anomalies in the order that on the surface make little sense.

One would assume compatibility mode would handle plugin issues like we encountered. As you know, Wordpress site owners put alot of faith in 3rd party developers to produce sound codebases. We fell victim to this from an official Woo plugin (how did that update pass QA?). This does not give me confidence in transitioning to HPOS.

Thanks for taking the time to read through this. I'm happy to answer any follow-ups as needed.

jorgeatorres commented 7 months ago

Hi @secureitgunstorage,

Thanks for the additional context here.

In reality, compatibility mode is really only useful of you are using the posts tables as the order datastore.

It's true that compatibility mode can be seen as less useful when HPOS is selected in that scenario, where manual updates to metadata don't make it to the new tables. This was by design as we want to prioritize changes to the order that are made in an HPOS compatible manner. Disambiguating changes to metadata made by a rogue plugin (by modifying postmeta) is not a straightforward process.

When HPOS is chosen, we do have some safety measures in place to try to catch changes made to the post directly. We look at the post's modification date to determine which version is newer and update the HPOS one if necessary. That wasn't happening in this case (from my understanding) so the updates to postmeta were not consider "newer" and precisely because HPOS was the authoritative datastore, the HPOS version was preserved.

A plugin from your extensions store which declared itself as HPOS compatible was not using the CRUD operations despite us selecting HPOS as the order datastore.

We tried our best to prevent switching datastores when there were incompatible plugins, but we also trust plugins to correctly declare their compatibility. With all the flexibility in WP/WC, it'd be very difficult to audit everything a plugin is doing with a given order/post.

That said, I do think there's value in at least logging or warning when such a 'rogue' change occurs when HPOS (and compatibility mode) are active. I've opened #44485 so that we can take a look and enhance compatibility mode. I still think it'd be difficult to automatically "merge" the changes (precisely because of the disambiguation issue I mentioned) but we could detect when plugins that indicated compatibility are not behaving as such (and possibly provide a way to log the change and reconcile).

As you know, Wordpress site owners put alot of faith in 3rd party developers to produce sound codebases. We fell victim to this from an official Woo plugin (how did that update pass QA?). This does not give me confidence in transitioning to HPOS.

I'm very sorry that this happened to you (and with an official plugin of all things). We rolled out HPOS very carefully and spent a lot of time testing before we made it the default. Even though it has other uses, we even added compatibility declaration precisely to make sure HPOS was able to play nice with other plugins and so we totally understand that things like this can decrease confidence.

We haven't received a lot of reports like this one, which does mean things are working ok for most users, but that's precisely why feedback like this is even more valuable to us.

It's my understanding that the problematic plugin in this case has since been fixed, but if you'd like to share which one it was, that would allow us to double check things and see if we have missed something on core's side too.

Thanks for taking the time to read through this. I'm happy to answer any follow-ups as needed.

Thank you for sharing your experience and for all of the details. Do let me know if you have any further comments or questions.

secureitgunstorage commented 6 months ago

https://woo.com/document/avalara-avatax/