1

I have to swap short product descriptions with long product descriptions in 200+ products in Woocommerce. Do you know any fast ways to do this? Database query, Better Search&Replace plugin? :-)

/swapping it on the front end side (how they are displayed on product page) is not enough - I need to map them in one module which doesn't support short desc./

All answers appreciated.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
Tim
  • 87
  • 1
  • 8

2 Answers2

0

First make always a database backup. Then you can try this simple SQL query that will swap product description with product short description on all WooCommerce published products (check that your WordPress database table start with wp_ before):

UPDATE wp_post AS p 
SET p.post_content=(@temp:=p.post_content), 
    p.post_content = p.post_excerpt, 
    p.post_excerpt = @temp 
WHERE p.post_type = 'product'
AND  p.post_status = 'publish';

Related: Swapping column values in MySQL

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
0

The answer by LoicTheAztec needs one modification. Specifically, the first line should be wp_posts not wp_post:

UPDATE wp_posts AS p
dbc
  • 104,963
  • 20
  • 228
  • 340