WordPress.org

Make WordPress Core

Opened 4 weeks ago

Closed 3 weeks ago

#42593 closed defect (bug) (worksforme)

Wordpress 4.9 upgrade deleting values from Woocommerce variations

Reported by: pwaara Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9
Component: Database Keywords:
Focuses: Cc:

Description

I just upgraded a site using Woocommerce to 4.9. The upgrade process deleted the attribute key and value for the variation attribute, but only if they used double quotes (or so it seems). For example, I have a WC variable product with about 10 variations for photography. The variation values are things like Metal Print 8" x 10", Metal Print 11" x 14", etc. I also have variable products that have variation values such as small, medium, and large. The variation names that had double quotes in them were removed (e.g., Metal Print 8" x 10"), but the variation names that didn't have double quotes did not get deleted (e.g., Small). The rest of the variation data seems to be there, but I haven't checked to see if there was anything else that had a double quote that got clobbered. I had to restore my site from backup to reclaim the lost data.

Attachments (2)

Variable-Product-Pre-Update.JPG (69.1 KB) - added by pwaara 4 weeks ago.
Snip of variations pre-update
Variable-Product-Post-Update.JPG (85.0 KB) - added by pwaara 4 weeks ago.
Snip of variations post-update

Download all attachments as: .zip

Change History (6)

@pwaara
4 weeks ago

Snip of variations pre-update

@pwaara
4 weeks ago

Snip of variations post-update

#1 @pwaara
4 weeks ago

Confirmed that the issue occurs using the TwentySeventeen theme. I've attached two snips showing the Variations before and after the update.

#2 @pwaara
4 weeks ago

Another clue. The variations that are losing their association to the specific attribute have a slash (/) in their name. That is, the name of the custom attribute is "Available Styles/Sizes". All products variations that use this custom attribute have "Any available Style..." after the update. I copied one of these products, created an identical custom attribute except I named it "Available Styles and Sizes" and did the update again. The product with the custom attribute "Available Styles and Sizes" was unaffected. The product variations with the slash in their custom attribute name lost their assigned attribute again.

#3 @claudiulodro
4 weeks ago

I'm able to reproduce this and have created an issue in WooCommerce: https://github.com/woocommerce/woocommerce/issues/17775

Most likely the behavior of a sanitize function or something changed slightly and we need to update WooCommerce to account for this change. I'll follow up here if it turns out the issue is caused by a bug in WP.

#4 @Clorith
3 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

WooCommerce ticket is closed with a fix on their end, caused by the change in sanitize_title_with_dashes() introduced in r41318 as slashes no longer get stripped but converted to dashes.

Related #10792

Note: See TracTickets for help on using tickets.