Add checkout detection in product page

This commit is contained in:
Pedro Silva 2023-06-28 15:15:49 +01:00
parent 4c33f0bee3
commit f517ac4719
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3

View file

@ -19,8 +19,9 @@ trait ContextTrait {
protected function context(): string {
if ( is_product() || wc_post_content_has_shortcode( 'product_page' ) ) {
// Detection if "woocommerce-one-page-checkout" is enabled for this product.
if ( is_callable( 'is_wcopc_checkout' ) && is_wcopc_checkout( get_the_ID() ) ) {
// 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';
}