Skip to content

Conversation

@roykho
Copy link
Contributor

@roykho roykho commented Aug 19, 2021

…tion closes #30532

All Submissions:

Changes proposed in this Pull Request:

Closes #30532

What's happening here is that some sites deliberately "unset" WC created pages such as the My-Account or Shop page. When updating to WC 5.6, there is a migration process that creates the Refund and Return Policy page. However we did not account for sites to have some pages not set for these and so these pages can reappear. This PR filters into the page creation list and removes the rest and only leaving the Refund and Return Policy page.

How to test the changes in this Pull Request:

  1. Go to /wp-admin/admin.php?page=wc-settings&tab=advanced and unset the My Account page or any of those pages and save.
    2 To trigger an db update you can change the woocommerce_db_version in the wp_options table to 5.5.0.
  2. Reload the admin woocommerce area and now you should see the update database notice. Click to update.
  3. After it is done and you see the "Thanks" notice, go back to /wp-admin/admin.php?page=wc-settings&tab=advanced and ensure the page you unsetted did not return.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Changelog entry

Fix - WC default pages are being re-created during db migration in some cases.

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

Copy link
Contributor

@jonathansadowski jonathansadowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the behavior prior to this PR, and that this PR did indeed correct the pages beging reset. 👍 Good job.

The failing nightly tests are unrelated to this change.

@jonathansadowski jonathansadowski merged commit ea4da50 into trunk Aug 19, 2021
@jonathansadowski jonathansadowski deleted the fix/30532 branch August 19, 2021 17:59
@jonathansadowski jonathansadowski added release: add changelog Mark all PRs that have not had their changelog entries added. [auto] release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Aug 19, 2021
@github-actions github-actions bot added this to the 5.7.0 milestone Aug 19, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Aug 19, 2021

Hi @jonathansadowski, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the status: needs changelog label
  • Add the status: needs testing instructions label

@rodelgc rodelgc added testing instructions added and removed release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: add changelog Mark all PRs that have not had their changelog entries added. [auto]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WooCommerce 5.6.0: default pages installed and activated after update

4 participants