skip to Main Content

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.

2

Answers


  1. 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

    Login or Signup to reply.
  2. The answer by LoicTheAztec needs one modification. Specifically, the first line should be wp_posts not wp_post:

    UPDATE wp_posts AS p
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search