🔀 Merge branch 'trunk'

This commit is contained in:
Philipp Stracker 2024-06-11 15:24:15 +02:00
commit 1f5caac2f1
No known key found for this signature in database
7 changed files with 133 additions and 61 deletions

View file

@ -57,12 +57,19 @@ class CartCheckoutDetector {
/**
* Check if the Checkout page is using Elementor.
*
* @param int $page_id The ID of the page.
*
* @return bool
*/
public static function has_elementor_checkout(): bool {
public static function has_elementor_checkout( int $page_id = 0 ): bool {
// Check if Elementor is installed and activated.
if ( did_action( 'elementor/loaded' ) ) {
$elementor_widgets = self::get_elementor_widgets( wc_get_page_id( 'checkout' ) );
if ( $page_id ) {
$elementor_widgets = self::get_elementor_widgets( $page_id );
} else {
// Check the WooCommerce checkout page.
$elementor_widgets = self::get_elementor_widgets( wc_get_page_id( 'checkout' ) );
}
if ( $elementor_widgets ) {
return in_array( 'woocommerce-checkout-page', $elementor_widgets, true );