Last active
August 4, 2026 14:35
-
-
Save xlplugins/1929cbb98668a961390bc056308d6806 to your computer and use it in GitHub Desktop.
Glozin Compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Plugin Name: WFACP × Glozin Compatibility | |
| * Description: Fixes Glozin theme/addons conflicts on FunnelKit Aero checkout — blank Elementor-editor form (checkout-limit TypeError), duplicate coupon/login, duplicate thumbnail, extra info box, payment-box overflow. | |
| * Version: 3.2.0 | |
| */ | |
| defined( 'ABSPATH' ) || exit; | |
| /** On, or editing, an Aero checkout (live page, preview, editor, or elementor_ajax render). */ | |
| function wfacp_glozin_aero() { | |
| return class_exists( 'WFACP_Common' ) | |
| && ( absint( WFACP_Common::get_id() ) > 0 | |
| || ( function_exists( 'wfacp_elementor_edit_mode' ) && wfacp_elementor_edit_mode() ) ); | |
| } | |
| /** Editing/previewing an Aero checkout in Elementor. */ | |
| function wfacp_glozin_editor() { | |
| return function_exists( 'wfacp_elementor_edit_mode' ) && wfacp_elementor_edit_mode(); | |
| } | |
| /** On a FunnelKit thank-you (order-details) page. */ | |
| function wfacp_glozin_thankyou() { | |
| return class_exists( 'WFFN_Core' ) | |
| && isset( WFFN_Core()->thank_you_pages ) | |
| && is_callable( array( WFFN_Core()->thank_you_pages, 'is_wfty_page' ) ) | |
| && true === WFFN_Core()->thank_you_pages->is_wfty_page(); | |
| } | |
| /** Strip Glozin callbacks that crash or duplicate WFACP's checkout header. */ | |
| add_action( 'woocommerce_before_checkout_form', function () { | |
| if ( ! wfacp_glozin_aero() ) { | |
| return; | |
| } | |
| // Blank editor form: Glozin checkout-limit str_replace()s the WC_Checkout object | |
| // (is_checkout() is false in the editor ajax) → TypeError → 500. Drop it in the editor. | |
| if ( wfacp_glozin_editor() && class_exists( '\Glozin\Addons\Modules\Checkout_Limit\Frontend' ) ) { | |
| remove_action( 'woocommerce_before_checkout_form', array( \Glozin\Addons\Modules\Checkout_Limit\Frontend::instance(), 'checkout_limit' ), 10 ); | |
| } | |
| // Theme's duplicate coupon + login. | |
| if ( class_exists( '\Glozin\WooCommerce\Checkout' ) ) { | |
| $c = \Glozin\WooCommerce\Checkout::instance(); | |
| foreach ( array( 'before_login_form', 'login_form', 'coupon_form', 'after_login_form' ) as $m ) { | |
| remove_action( 'woocommerce_before_checkout_form', array( $c, $m ), 10 ); | |
| } | |
| } | |
| }, 1 ); | |
| /** Theme's extra info box in the order review. */ | |
| add_action( 'woocommerce_checkout_order_review', function () { | |
| if ( wfacp_glozin_aero() && class_exists( '\Glozin\WooCommerce\Checkout' ) ) { | |
| remove_action( 'woocommerce_checkout_order_review', array( \Glozin\WooCommerce\Checkout::instance(), 'information_box' ), 30 ); | |
| } | |
| }, 1 ); | |
| /** Theme injects a 2nd product image into the cart-item name → duplicate summary thumbnail. */ | |
| add_filter( 'woocommerce_cart_item_name', function ( $name ) { | |
| if ( wfacp_glozin_aero() && class_exists( '\Glozin\WooCommerce\General' ) ) { | |
| remove_filter( 'woocommerce_cart_item_name', array( \Glozin\WooCommerce\General::instance(), 'review_product_name_html' ), 10 ); | |
| } | |
| return $name; | |
| }, 1 ); | |
| /** Same theme trick on the order-item name → duplicate image in the FunnelKit thank-you summary. */ | |
| add_filter( 'woocommerce_order_item_name', function ( $name ) { | |
| if ( wfacp_glozin_thankyou() && class_exists( '\Glozin\WooCommerce\General' ) ) { | |
| remove_filter( 'woocommerce_order_item_name', array( \Glozin\WooCommerce\General::instance(), 'order_item_name' ), 20 ); | |
| } | |
| return $name; | |
| }, 1 ); | |
| /** Editor ajax skips WooCommerce frontend includes; load them so the fields can render. */ | |
| add_action( 'init', function () { | |
| if ( wfacp_glozin_editor() && function_exists( 'WC' ) && WC() && ! function_exists( 'woocommerce_form_field' ) && is_callable( array( WC(), 'frontend_includes' ) ) ) { | |
| WC()->frontend_includes(); | |
| } | |
| }, 4 ); | |
| /** | |
| * Don't load the Glozin theme's checkout stylesheet on the Aero checkout. WFACP ships its own | |
| * complete checkout CSS; the theme's checkout.min.css only adds its 2-column layout (float/width/ | |
| * sticky, payment negative margins, button effects) that fight WFACP's single-column design. | |
| */ | |
| add_action( 'wp_enqueue_scripts', function () { | |
| if ( wfacp_glozin_aero() ) { | |
| wp_dequeue_style( 'glozin-checkout' ); | |
| } | |
| }, 100 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment