Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
86 stars 32 forks source link

[HPOS] Update CSS/JS to work with new admin screens #333

Closed brucealdridge closed 1 year ago

brucealdridge commented 1 year ago

Fixes #322

Note This PR is targeting the hpos-admin-ui-support branch due to the changes required for admin screens in HPOS environments awaiting merge

Description

When HPOS is enabled the default WP admin screens for custom post types can no longer be used. WooCommerce has introduced new admin screens which have changed some of the underlying functionality that we rely on.

For javascript and CSS, we relied on the class post-type-shop_subscription being added to the <body> tag. With HPOS enabled this no longer happens. Instead we can use the woocommerce_page_wc-orders--shop_subscription class.

This PR adds this class as an additional rule anywhere the old class was used.

Before image

After image

How to test this PR

Product impact

james-allan commented 1 year ago

@Jinksi do you mind checking that I've applied the changes to this PR as you recommended?

james-allan commented 1 year ago

Just noting that there are phpcs issues unrelated to the changes in this PR. We can address those once a PR for the base branch is raised.

Jinksi commented 1 year ago

LGTM @james-allan 👍 although your prettier seemed to skip the bracketSpacing: true rule.

https://github.com/Automattic/woocommerce-subscriptions-core/blob/3122c99060c9e8bf7e19c791a37cdfe054b5167e/.prettierrc#L7

I've pushed up these changes in 3122c99, hope that's ok 😄