Skip to content

Instantly share code, notes, and snippets.

@mikejolley
Last active May 11, 2017 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikejolley/7dc21432643a4fdd342474dc2694a22d to your computer and use it in GitHub Desktop.
Save mikejolley/7dc21432643a4fdd342474dc2694a22d to your computer and use it in GitHub Desktop.
Update trashed variations to publish - replace wp_posts with the correct prefix!
UPDATE wp_posts SET post_status = 'publish' WHERE post_type = 'product_variation' AND post_status = 'trash';
@margzmi
Copy link

margzmi commented Apr 9, 2017

hello Mike,
I don't know what to do with this txt, could you tell me the steps to follow please? :)

thank you

@mrqaidi
Copy link

mrqaidi commented Apr 10, 2017

margzmi
go to phpmyadmin and then go to wordpress database then go to SQL paste this code
UPDATE wp_posts SET post_status = 'publish' WHERE post_type = 'product_variation' AND post_status = 'trash';
and click GO

@margzmi
Copy link

margzmi commented Apr 10, 2017

thank youuuu mrqaidi, I tried it but nothing changed :(
In fact, all variations disappeared after woocommerce pudate... After that I updated all the variations of my products but the parent's quantities don't work (it always shows no stock for all variations even if the parent stock is for example 22). And when I pick one variation, the related image doesn't appear in front as it was before :( This didn't change even using this code ... Any idea please?

@arleydaza
Copy link

Tras la actualización de un Woocommerce 2.8 a la versión 3.0.1 y luego de actualizar la plantilla (asegurando su compatibilidad), me di cuenta que las variaciones no estaban en la administración y no funcionaban en el front. Ejecuté en el PhpMyAdmin la consulta SQL que dejaste:

UPDATE wp_posts SET post_status = 'publish' WHERE post_type = 'product_variation' AND post_status = 'trash';

Luego, limpié el caché de mi navegador... y ya pude ver las variaciones en el backend como en el front. MIL GRACIAS.

@fjkuypers
Copy link

fjkuypers commented May 10, 2017

I am at WC 3.0.6 and just ran SQL string. It seems to have affected 16 records, it seems to have done the trick for some products. Not all I am afraid :(

@lynn219
Copy link

lynn219 commented May 11, 2017

I'm having issues as well. Haas this been resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment