• Resolved jonfitzgerald

    (@jonfitzgerald)


    Hey all,

    I’m working on a site where we’ve imported a large amount of products (footwear and apparel) from a third part platform.

    Before the import, I created a custom style to display the product size selection in a different way than the default drop down.

    Unfortunately, the products have all imported with a ‘custom’ size attribute, which of course aren’t linked to the ‘global’ size attribute, meaning the styling isn’t working.

    Is there an easy way I can update the attributes of these products from the custom ‘size’ attribute to the global ‘pa_size’ attribute?

    I found this script, which sounds like exactly what I need:

    https://gist.github.com/birgire/0ed300ae4436fcaf508c

    But I haven’t been able to get it working.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • madeincosmos

    (@madeincosmos)

    Automattic Happiness Engineer

    Hi @jonfitzgerald,

    That’s a tricky case, as global attribute data is stored in completely different database structures than local ones, so migrating this programmatically would be quite complicated.

    You’ve mentioned the products were imported to your site–did you use the built in CSV importer? There’s an option in it to determine whether each attribute should be global or local (Attribute 1 Global, Attribute 2 Global), as described here:

    https://github.com/woocommerce/woocommerce/wiki/Product-CSV-Import-Schema#csv-columns-and-formatting

    Perhaps you could try exporting all products again, flipping that Attribute Global column and importing them back in? This should be faster than trying to change the values in custom code.

    Cheers!

    madeincosmos

    (@madeincosmos)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’ll mark this thread as resolved now. If you have some more questions, feel free to start a new one.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Update custom attributes to global’ is closed to new replies.