Merge pull request #1473 from woocommerce/PCP-1816-incompatibility-with-woo-commerce-one-page-checkout-or-similar-use-cases-in-version-2-1-0

Incompatibility with WooCommerce One Page Checkout (or similar use cases) in Version 2.1.0 (1816)
This commit is contained in:
Emili Castells 2023-07-03 11:55:28 +02:00 committed by GitHub
commit 1fd0899149
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,6 +18,13 @@ trait ContextTrait {
*/
protected function context(): string {
if ( is_product() || wc_post_content_has_shortcode( 'product_page' ) ) {
// Do this check here instead of reordering outside conditions.
// In order to have more control over the context.
if ( ( is_checkout() ) && ! $this->is_paypal_continuation() ) {
return 'checkout';
}
return 'product';
}