From f517ac4719cbb2a1f5088d6db69afedbd0a66813 Mon Sep 17 00:00:00 2001
From: Pedro Silva
Date: Wed, 28 Jun 2023 15:15:49 +0100
Subject: [PATCH] Add checkout detection in product page
---
modules/ppcp-button/src/Helper/ContextTrait.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/modules/ppcp-button/src/Helper/ContextTrait.php b/modules/ppcp-button/src/Helper/ContextTrait.php
index 55169dac8..e1af3e3c0 100644
--- a/modules/ppcp-button/src/Helper/ContextTrait.php
+++ b/modules/ppcp-button/src/Helper/ContextTrait.php
@@ -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';
}