How to: Get WooCommerce to automatically recreate pages

How to get WooCommerce to automatically recreate pages

As a WooCommerce user you are likely to encounter the need to recreate the pages the system creates during install at one point in your life. Sometimes you just accidentally delete a page, in other scenarios you are messing with the backend (database) and need to reinstall the system, but in other cases such as mine from one version to the next there is this new functionality in a new page you are simply missing because you have the old set of pages. Another possible scenario is that you set up your system in the default language (probably English) and after that you wish to change to another language (say Spanish) but those pages now at least their names are in English.

This could be very frustrating, as the next best thing you could possibly come up with would be to reinstall wordpress and WooCommerce or use another installation to copy the page contents to yours. However, there are a few workaround that will force WooCommerce to reinstall your pages and therefore you can have the latest and greatest versions in the currently supported language your instance is running on.

Workaround 1:

In order to force the page creation dialog to reappear simply follow these steps:

  1. Simply go to WooCommerce > Pages
  2. Unset all of the select boxes for pages (including the shop base option)
  3. De-activate the WooCommerce plugin
  4. Re-activate the WooCommerce plugin
  5. It will ask you whether or not you want to install the pages, yay!

 

Workaround 2:

If you notice what happens when you install WooCommerce during the first time or after you follow workaround 2 is that a URL parameter is used to indicate the WooCommerce settings page to recreate the pages. In that case you could follow this simple instructions to do the same:

  1. Make sure you have deleted the current pages. I am not certain this is necessary but this way you ensure the names are correct and the URLs are not in use by other pages. You may wish to try without doing this to see if there is any impact.
  2. Now, enter the admin backend and go to WooCommerce > Settings. Take a look at the URL: http://MySite.Bauzas.com/wp-admin/admin.php?page=woocommerce_settings
  3. simply add “&install_woocommerce_pages=true” to the Settings page URL and it will force the process to recreate the pages. Your URL should look like: http://MySite.Bauzas.com/wp-admin/admin.php?page=woocommerce_settings&install_woocommerce_pages=true

I have personally tried both workarounds/solutions with no problems. I have been bugged by not having all the pages set on one of my installations plus the ones I had were in a different language. This made it possible for me to get the latest pages on the correct language without too much effort. Do share your experience and let me know if you have any issues.

Enhanced by Zemanta

You may also like...

2 Responses

  1. Hashwin says:

    The last work around really worked for me! Great 🙂 Saved a good 15 min do it all manually

  2. Vedran Sego says:

    There is also a simple programmatic way (for plugin/themes authors): `WC_Install::create_pages();`.

Leave a Reply to Hashwin Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.