woocommerce / woocommerce

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

Restoring product from trash leaves variations in draft #28862

Closed RiaanKnoetze closed 3 years ago

RiaanKnoetze commented 3 years ago

Prerequisites (mark completed items with an [x]):

Describe the bug When a variable product is restored from trash, the attached variations are not restored either. It looks like they're "stuck" in the database as being in "draft" with no way to "publish" individual variations using the UI on the front-end.

Expected behavior Restoring a trashed variable product will restore the associated variations as well.

Actual behavior When restoring a variable product, the attributes are restored but the variations aren't.

Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.) Steps to reproduce the bug:

  1. Create a new variable product with attributes and variations assigned (along with prices for each variation)
  2. Once created, trash the product
  3. Navigate to WooCommerce > Products > Trashed and restore the product
  4. In the newly restored variable product, navigate to the "Variations" tab and notice that they're now all empty

Screenshots

Arttributes for restored variable product:

https://d.pr/i/7sv5R1 Full Image: https://d.pr/i/7sv5R1

Variations for restored variable product:

https://d.pr/i/pYxfto Full Image: https://d.pr/i/pYxfto

Isolating the problem (mark completed items with an [x]):

WordPress Environment We use the WooCommerce System Status Report to help us evaluate the issue. Without this report we won't be able to fully evaluate this issue.

``` ### WordPress Environment ### WordPress address (URL): https://wc.local Site address (URL): https://wc.local WC Version: 4.9.0 REST API Version: ✔ 4.9.0 WC Blocks Version: ✔ 4.0.0 Action Scheduler Version: ✔ 3.1.6 WC Admin Version: ✔ 1.8.3 Log Directory Writable: ✔ WP Version: 5.6 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: 7.3.5 PHP Post Max Size: 1,000 MB PHP Time Limit: 70 PHP Max Input Vars: 4000 cURL Version: 7.54.0 LibreSSL/2.6.5 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: 4.9.0 WC Database Prefix: wp_ Total Database Size: 10.71MB Database Data Size: 8.20MB Database Index Size: 2.51MB wp_woocommerce_sessions: Data: 0.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: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 0.06MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + 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.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_actions: Data: 0.02MB + Index: 0.11MB + 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: 0.02MB + Index: 0.03MB + Engine InnoDB wp_advanced_notification_triggers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_advanced_notifications: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_automatewoo_abandoned_carts: Data: 0.02MB + Index: 0.08MB + Engine InnoDB wp_automatewoo_customer_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_automatewoo_customers: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_automatewoo_events: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_automatewoo_guest_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_automatewoo_guests: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_automatewoo_log_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_automatewoo_logs: Data: 0.02MB + Index: 0.05MB + 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_automatewoo_referral_advocate_keys: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_automatewoo_referral_invites: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_automatewoo_referrals: Data: 0.02MB + Index: 0.08MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_email_log: Data: 0.33MB + Index: 0.00MB + Engine InnoDB wp_layerslider: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_layerslider_revisions: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_ms_snippets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_options: Data: 6.06MB + Index: 0.09MB + Engine InnoDB wp_postmeta: Data: 0.27MB + Index: 0.23MB + Engine InnoDB wp_posts: Data: 0.08MB + Index: 0.06MB + Engine InnoDB wp_snippets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_booking_relationships: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_bookings_availability: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_bookings_availabilitymeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_points_rewards_user_points: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_points_rewards_user_points_log: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + 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_wcpv_commissions: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wcpv_per_product_shipping_rules: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wcrs_logs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_bundled_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_bundled_items: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_per_product_shipping_rules: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_subscription_downloads: Data: 0.02MB + Index: 0.00MB + Engine InnoDB ### Post Type Counts ### af_product_videos: 1 attachment: 23 avia_framework_post: 6 aw_workflow: 1 custom_css: 1 global_product_addon: 1 nav_menu_item: 6 page: 13 post: 3 product: 32 product_variation: 21 revision: 6 shop_coupon: 2 shop_order: 19 shop_subscription: 4 wcpf_item: 4 wcpf_project: 1 ### Security ### Secure connection (HTTPS): ✔ Hide errors from visitors: ✔ ### Active Plugins (9) ### Code Snippets: by Code Snippets Pro – 2.14.0 Email Log: by Sudar – 2.4.3 Plugin Toggle: by Cedaro – 1.3.1 User Switching: by John Blackbourn & contributors – 1.5.6 WooCommerce Checkout Field Editor: by WooCommerce – 1.5.38 WooCommerce Stripe Gateway: by WooCommerce – 4.7.0 WooCommerce Quick View: by WooCommerce – 1.3.1 WooCommerce Subscriptions: by WooCommerce – 3.0.12 WooCommerce: by Automattic – 4.9.0 (update to version 4.9.1 is available) ### Inactive Plugins (129) ### Add To Cart Redirect for WooCommerce: by Jeroen Sormani – 1.0.3 – Installed version not tested with active version of WooCommerce 4.0 Admin category search: by Atilla Ordog – 1.0 Advanced Editor Tools (previously TinyMCE Advanced): by Automattic – 5.6.0 Affiliate For WooCommerce: by StoreApps – 2.8.4 Akismet Anti-Spam: by Automattic – 4.1.8 Auctions for WooCommerce: by WPInstitut – 1.5 AutomateWoo: by WooCommerce – 5.2.1 AutomateWoo - Refer A Friend Add-on: by WooCommerce – 2.5.7 AutomateWoo - Subscriptions Add-on: by Prospress Inc. – 1.0.1 – Installed version not tested with active version of WooCommerce 4.0 AutomateWoo - Templates: by EasyExtend – 1.0.0 – Installed version not tested with active version of WooCommerce 4.0 bbPress: by The bbPress Contributors – 2.6.6 Bookings Helper: by WooCommerce – 1.0.2 – Installed version not tested with active version of WooCommerce 4.0 Braintree for WooCommerce Payment Gateway: by WooCommerce – 2.4.3 Bulk Order Form For WooCommerce: by wpexpertsio – 1.1.2 – Installed version not tested with active version of WooCommerce 4.0 Caxton: by PootlePress – 1.27.0 Customize Event Google Calendar for WooCommerce Booking: by Ivan Barreda – 1.0.1 – Installed version not tested with active version of WooCommerce 4.0 Custom User Registration Fields for WooCommerce: by Addify – 1.6.3 Debug Bar: by wordpressdotorg – 1.1.2 Debug Bar Cache Lookup: by Allan Collins – 0.1.1 Debug Objects: by Frank Bültge – 2.5.0 Disable Real MIME Check: by Sergey Biryukov – 1.0 Easy Google Fonts: by Titanium Themes – 1.4.4 Email Templates: by Damian Logghe – 1.3.1.2 Enable jQuery Migrate Helper: by The WordPress Team – 1.3.0 Enhancer for WooCommerce Subscriptions: by FantasticPlugins – 2.0 Export shipping zones: by Rynaldo Stoltz – 1.3 Follow-Up Emails: by WooCommerce – 4.9.10 GD Library Check: by Riaan Knoetze – 1.0 GDPR Cookie Consent: by WebToffee – 1.9.5 Health Check & Troubleshooting: by The WordPress.org community – 1.4.5 Hello Dolly: by Matt Mullenweg – 1.7.2 Homepage Control: by WooThemes – 2.0.3 Insert Headers and Footers: by WPBeginner – 1.5.0 Kadence WooCommerce Email Designer: by Kadence WP – 1.4.4 List Products By Category Widget For WooCommerce: by Blaze Concepts – 1.3.0 Loco Translate: by Tim Whitlock – 2.5.0 Mailchimp for WooCommerce: by Mailchimp – 2.5.0 Matty Theme QuickSwitch: by Matty – 1.2.3 One Click Demo Import: by ProteusThemes – 2.6.1 Oxygen: by Soflyy – 3.5 Point of Sale for WooCommerce: by Actuality Extensions – 5.3.5 Product FAQs: by 99w – 1.0.6 Product Filters for WooCommerce: by WooCommerce – 1.2.4 Product Video for WooCommerce: by Addify – 1.3.5 Quote Request for WooCommerce: by FantasticPlugins – 1.5 Request a Quote for WooCommerce: by Addify – 2.1.0 Say What?: by Lee Willis – 1.9.6 Show Current Template: by JOTAKI Taisuke – 0.4.2 Smart Manager For WooCommerce – Stock Management, Bulk Edit & more...: by StoreApps – 5.3.0 Sticky Cart For WooCommerce: by SkroTron – 1.1.4 – Installed version not tested with active version of WooCommerce 4.0 Storefront - Lefthand Account Tabs: by Riaan K. | WooCommerce – 1.0 Storefront Horizontal Tabs: by Riaan K. | WooCommerce – 1.0 – Installed version not tested with active version of WooCommerce 4.0 Storefront Mega Menus: by WooCommerce – 1.6.2 – Installed version not tested with active version of WooCommerce 4.0 Storefront Powerpack: by WooCommerce – 1.5.0 Templates Pro for AutomateWoo: by EasyExtend – 1.0 Term Duplicator: by CGD Inc. – 1.0.0 Testimonials: by WooThemes – 1.5.4 Theme Customisations: by WooThemes – 1.0.0 Tiered Price Table for WooCommerce: by Kolya Lukin – 3.1.1 Top 50 WP: by PootlePress – 1.0.0 User Role Editor: by Vladimir Garagulya – 4.58.2 Walmart Integration for WooCommerce: by CedCommerce – 2.0.5 WC Custom Add to Cart labels: by Rynaldo Stoltz – 1.3 WooCommerce - ShipStation Integration: by WooCommerce – 4.1.40 WooCommerce 360° Image: by WooCommerce – 1.1.19 WooCommerce Accommodation Bookings: by WooCommerce – 1.1.22 WooCommerce Additional Variation Images: by WooCommerce – 1.8.1 WooCommerce Admin: by WooCommerce – 1.8.3 WooCommerce Admin Custom Order Fields: by SkyVerge – 1.15.0 WooCommerce Advanced Notifications: by WooCommerce – 1.2.29 WooCommerce Advanced Product Labels: by Jeroen Sormani – 1.1.7 – Installed version not tested with active version of WooCommerce 4.0 WooCommerce Advanced Shipping Packages: by Jeroen Sormani – 1.1.7 WooCommerce All Products For Subscriptions: by SomewhereWarm – 3.1.23 WooCommerce Blocks: by Automattic – 4.2.0 WooCommerce Bookings: by WooCommerce – 1.15.33 (update to version 1.15.34 is available) WooCommerce Bookings Filters: by Codup – 1.2.0.10 WooCommerce Box Office: by WooCommerce – 1.1.30 WooCommerce Branding: by WooCommerce – 1.0.29 WooCommerce Brands: by WooCommerce – 1.6.23 WooCommerce Cart Notices: by SkyVerge – 1.13.0 WooCommerce Chained Products: by StoreApps – 2.9.9 WooCommerce Composite Products: by SomewhereWarm – 7.1.6 WooCommerce Conditional Shipping and Payments: by SomewhereWarm – 1.8.11 WooCommerce Deposits: by WooCommerce – 1.5.6 WooCommerce Distance Rate Shipping: by Automattic – 1.0.26 WooCommerce Dynamic Pricing: by Lucas Stark – 3.1.22 Woocommerce Email Admin On Completed Order: by Özgür Özdemir – 0.1 – Installed version not tested with active version of WooCommerce 4.0 WooCommerce Email Customizer: by WooCommerce – 1.1.18 WooCommerce EU VAT Number: by WooCommerce – 2.3.25 WooCommerce eWAY Payment Gateway: by WooCommerce – 3.1.25 WooCommerce Force Sells: by WooCommerce – 1.1.27 WooCommerce Google Analytics Integration: by WooCommerce – 1.5.0 WooCommerce LightSpeed POS: by RafiLabs – 1.9.7 WooCommerce Local Pickup Plus: by SkyVerge – 2.9.3 WooCommerce Measurement Price Calculator: by SkyVerge – 3.19.0 WooCommerce Memberships: by SkyVerge – 1.20.0 WooCommerce Min/Max Quantities: by WooCommerce – 2.4.20 WooCommerce One Page Checkout: by Automattic – 1.7.10 WooCommerce Order Delivery: by Themesquad – 1.8.4 (update to version 1.8.5 is available) WooCommerce PayPal Checkout Gateway: by WooCommerce – 2.1.1 WooCommerce PDF Product Vouchers: by SkyVerge – 3.8.2 WooCommerce Photography: by WooCommerce – 1.0.27 WooCommerce Points and Rewards: by WooCommerce – 1.6.42 WooCommerce POS: by kilbot – 0.4.25 WooCommerce Pre-Orders: by WooCommerce – 1.5.29 WooCommerce Product Add-ons: by WooCommerce – 3.3.0 WooCommerce Product Bundles: by SomewhereWarm – 6.7.2 WooCommerce Product CSV Import Suite: by WooCommerce – 1.10.38 WooCommerce Product Vendors: by WooCommerce – 2.1.45 WooCommerce Referral System: by Codup.io – 1.3.4.19 WooCommerce Shipping Per Product v2: by WooCommerce – 2.3.12 WooCommerce Ship to Multiple Addresses: by WooCommerce – 3.6.25 WooCommerce Smart Coupons: by StoreApps – 4.15.0 WooCommerce Splash Popup: by WooCommerce – 1.2.19 WooCommerce Square: by WooCommerce – 2.2.5 WooCommerce Store Credit: by Themesquad – 3.4.4 WooCommerce Subscription Downloads: by WooCommerce – 1.1.31 WooCommerce Subscriptions - Advanced Options: by Automattic. – 1.0 – Installed version not tested with active version of WooCommerce 4.0 WooCommerce Subscriptions Gifting: by WooCommerce – 2.1.2 WooCommerce Table Rate Shipping: by WooCommerce – 3.0.30 WooCommerce Xero Integration: by WooCommerce – 1.7.34 WooCommerce Zapier: by OM4 – 2.0.7 WooSidebars: by WooCommerce – 1.4.5 WP Crontrol: by John Blackbourn & crontributors – 1.9.0 WPML Multilingual CMS: by OnTheGoSystems – 4.0.7 WP Notification Center: by Never5 – 1.0.1 WP Reset: by WebFactory Ltd – 1.82 Yoast Duplicate Post: by Enrico Battocchi & Team Yoast – 4.0.2 Yoast SEO: by Team Yoast – 15.6.2 ### Must Use Plugins (1) ### Local by Flywheel Live Link Helper: by Flywheel – 1.1 ### Settings ### API Enabled: – Force SSL: – Currency: GBP (£) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: booking (booking) bundle (bundle) composite (composite) external (external) grouped (grouped) simple (simple) subscription (subscription) variable (variable) variable subscription (variable-subscription) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: ✔ ### WC Pages ### Shop base: #8 - /shop/ Cart: #9 - /cart/ Checkout: #10 - /checkout/ My account: #11 - /my-account/ Terms and conditions: ❌ Page not set ### Theme ### Name: Storefront Version: 3.3.0 Author URL: https://woocommerce.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: – ### Subscriptions ### WCS_DEBUG: ✔ No Subscriptions Mode: ✔ Live Subscriptions Live URL: https://wc.local Subscription Statuses: wc-active: 1 wc-on-hold: 3 WooCommerce Account Connected: ✔ Yes Active Product Key: ❌ No Report Cache Enabled: ✔ Yes Cache Update Failures: ✔ 0 failure ### Store Setup ### Country / State: United Kingdom (UK) ### Subscriptions by Payment Gateway ### Direct bank transfer: wc-on-hold: 2 wc-active: 1 Cash on delivery: wc-on-hold: 1 ### Payment Gateway Support ### Direct bank transfer: products Cash on delivery: products PayPal Standard: subscription_payment_method_change_customer subscription_payment_method_change_admin subscription_amount_changes subscription_date_changes multiple_subscriptions subscription_payment_method_delayed_change subscriptions subscription_cancellation subscription_suspension subscription_reactivation products refunds PayPal Reference Transactions Enabled: ✔ Yes ### Action Scheduler ### Complete: 44 Oldest: 2020-12-21 07:21:51 +0000 Newest: 2021-01-19 11:37:59 +0000 Pending: 1 Oldest: 2021-01-21 17:18:41 +0000 Newest: 2021-01-21 17:18:41 +0000 ```
roykho commented 3 years ago

Thanks for reporting! This issue should be fixed here https://github.com/woocommerce/woocommerce/pull/28690 and will be going out with version 5.0.