From 9fdcef4b0d186842d2be0eae046abe1e3df1540a Mon Sep 17 00:00:00 2001 From: Alex P Date: Tue, 31 Oct 2023 11:32:19 +0200 Subject: [PATCH] Add before/after message wrapper hooks --- modules/ppcp-button/src/Assets/SmartButton.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/ppcp-button/src/Assets/SmartButton.php b/modules/ppcp-button/src/Assets/SmartButton.php index 5a802ab2c..e47f76884 100644 --- a/modules/ppcp-button/src/Assets/SmartButton.php +++ b/modules/ppcp-button/src/Assets/SmartButton.php @@ -685,7 +685,8 @@ class SmartButton implements SmartButtonInterface { $product = wc_get_product(); - $location = $this->location(); + $location = $this->location(); + $location_hook = $this->location_to_hook( $location ); if ( $location === 'product' && is_a( $product, WC_Product::class ) @@ -697,7 +698,17 @@ class SmartButton implements SmartButtonInterface { return; } + /** + * A hook executed before rendering of the PCP Pay Later messages wrapper. + */ + do_action( "ppcp_before_{$location_hook}_message_wrapper" ); + echo '
'; + + /** + * A hook executed after rendering of the PCP Pay Later messages wrapper. + */ + do_action( "ppcp_after_{$location_hook}_message_wrapper" ); } /**