Automattic / woocommerce-services

WooCommerce Services is a feature plugin that integrates hosted services into WooCommerce (3.0+), and currently includes automated tax rates and the ability to purchase and print USPS shipping labels.
GNU General Public License v2.0
108 stars 20 forks source link

Allow WC Shipping to use larger migration state machine enums #2804

Closed kallehauge closed 2 months ago

kallehauge commented 2 months ago

Description

We'll start using the "state machine" in WC Shipping as well to make the overall structure a bit more consistent.

That means we cannot guarantee that WCS&T will know all states anymore, so this PR aims to disable our migration banner / feature announcement modal when the value is greater than COMPLETED.

_I also sneaked in a few __()._

Related issue(s)

Steps to reproduce & screenshots/GIFs

  1. Checkout trunk
  2. Disable WC Shipping (if it's enabled)
  3. Run wp option set wcshipping_migration_state 13 ("COMPLETE" is 12, so 13 or anything higher will be good for testing)
  4. Go to /wp-admin/admin.php?page=wc-orders
  5. Verify you see the migration banner
  6. Go to any shippable order
  7. Open the Create shipping label modal
  8. Verify you see the Feature Announcement modal
  9. Checkout this branch
  10. Refresh the order page
  11. Open the Create shipping label modal
  12. Verify the Feature Announcement is no longer showing
  13. Go to /wp-admin/admin.php?page=wc-orders
  14. Verify the banner is no longer showing
  15. Bonus!
    • Run wp option set wcshipping_migration_state 1 and verify the banner and feature announcement modal is showing since it's in a "not begun" state.
    • Run wp option set wcshipping_migration_state 12 and verify the banner and feature announcement modal is hidden since it's in a "COMPLETED" state.

Note: you might have issues seeing any of the migration banners/modals if you have the wcst-wcshipping-migration-dismissed cookie that temporarily hides everything.

Checklist