Closed daledupreez closed 3 months ago
@daledupreez suggested this might be a timing issue and I'm inclined to agree after some testing.
I created two sites with the Woo Express and Entrepreneur plans and both had HPOS disabled by default. Then I created a site with the Creator plan and installed WooCommerce on its own after transferring the site to Atomic, and HPOS was enabled.
It's noted in the P2 post that some sites temporarily display a notice 1 Incompatible plugin detected (WooPayments)
and we do check to see if there are incompatible plugins before enabling HPOS, so we may be in the process of activating WooCommerce at the same time we're trying to activate plugins that are dependent on WooCommerce, and perhaps that creates a conflict that causes HPOS to remain disabled?
fbhepr%2Skers%2Sjcpbz%2Sjc%2Qpbagrag%2Scyhtvaf%2Sjbbpbzzrepr%2Sjbbpbzzrepr%2Q8.6.1.1%2Svapyhqrf%2Spynff%2Qjp%2Qvafgnyy.cuc%3Se%3Qno1o8611%23934-og
This appears to be the software installation process for Atomic sites, for posterity:
When we activate WooCommerce we do so alongside a host of other software some of which is dependent on WooCommerce being active: fbhepr%2Skers%2Sjcpbz%2Sjc%2Qpbagrag%2Syvo%2Sngbzvp%2Sjbn%2Qrpbzzrepr%2Qfbsgjner.cuc%3Se%3Qqo9nqq92%2323-og
At the point where we install software on the Atomic site, WC is part of a larger bundle that's passed to site_manage_software
:
fbhepr%2Skers%2Sjcpbz%2Snflap%2Qwbof%2Svapyhqrf%2Sjbn%2Sjbn%2Qgenafsre.cuc%3Se%3Q8498pn2q%23381-og
Which calls an Atomic API endpoint site-manage-software
:
fbhepr%2Skers%2Sjcpbz%2Sjc%2Qpbagrag%2Syvo%2Sjcpbz%2Qfvgrf%2Qba%2Qngbzvp.cuc%3Se%3Q093p161p%26sv%3Qfvgr_znantr_fbsgjner%231471-og
Which queues an async job with the software bundle as an array/object of software slugs and actions: fbhepr%2Skers%2Sjcpbz%2Sngbzvp.ncv%2Svapyhqrf%2Spynff%2Qngbzvp%2Qncv.cuc%3Se%3Q61631489%232926-og
But I'm having trouble finding where the software is installed and activated within the async jobs.
I managed to reproduce this using WP-CLI, and I think there is something going on with the way Woo detects (in)compatible plugins.
From a clean site with no previous Woo options or install, I ran the following command to install and activate WooCommerce:
wp --skip-plugins --skip-themes plugin install woocommerce --activate
After doing that, the HPOS option was disabled.
Looking at the code more closely, it looks like the way this is actually updated is based on the first admin visit to the site.
The logic to call WC_Install::maybe_enable_hpos()
is driven by the 'woocommerce_newly_installed'
hook, which itself is triggered from WC_Install::newly_installed()
.
In turn WC_Install::newly_installed()
is hooked on 'admin_init'
: https://github.com/woocommerce/woocommerce/blob/e765a717d23445cf62efd811628eb77f3c422a4e/plugins/woocommerce/includes/class-wc-install.php#L288
The complication we may hit is that for eCommerce/Woo Express sites, we probably add our sample content before the admin_init
action is ever fired, which would then disqualify us from enabling HPOS.
After chatting about it in p1715794796764419-slack-C0Q664T29 I started a diff to manually enable HPOS for sites coming through /setup/wooexpress
and /setup/ecommerce
to start: D148861-code
We've fixed this for incoming sites from /setup/wooexpress
and /setup/ecommerce
, but still needs to be fixed for users who select the e-commerce plan on signing up.
Noting that I did a quick test of /setup/wooexpress
and I'm still seeing it set to legacy storage (blog id: 234366614).
@daledupreez Also noting that I made a new site with the Creator plan and installed WooCommerce using
wp --skip-plugins --skip-themes plugin install woocommerce --activate
and HPOS was correctly enabled.
I think this should be fixed with the new HPOS work we shipped. Closing for now.
Prerequisites
Describe the bug
Sites that are being created with the Entrepreneur plan or the Woo Express trial plan are not always being created with the WooCommerce HPOS feature enabled, which should be the default for new WooCommerce installs.
This was reported internally in plenty of detail in p9F6qB-faq-p2
Expected behavior
When a site first gets WooCommerce installed (which happens as part of the transfer process for Entrepreneur and Woo Express sites), the HPOS feature should be enabled by default.
Actual behavior
The HPOS feature is not enabled in a number of cases.
Steps to reproduce
_cli
into it.wp wc hpos status
HPOS enabled? no
meaning that the site was created with HPOS disabled. In non-WPCOM installations, HPOS is enabled by default. And if I’m not mistaken, HPOS had been enabled by default in Woo Express and WPCOM sites in the past./wp-admin/admin.php?page=wc-settings&tab=advanced§ion=features
, you will notice thatWordPress posts storage (legacy)
was selected instead ofHigh-performance order storage (recommended)
which confirms that the site was created with HPOS disabled.WordPress Environment
Not needed - this occurs during install.
Isolating the problem