Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / Funnelkit Checkout: Enable Delete Item for special Addon product by sliding cart
Last active July 10, 2025 04:04
Funnelkit Checkout: Enable Delete Item for special Addon product by sliding cart
class Funnekit_Enable_delete_Specail_Add_on {
public function __construct() {
add_filter( 'wfacp_enable_delete_item', [ $this, 'display' ], 101, 2 );
}
public function display( $status, $cart_item ) {
if (isset($cart_item['_fkcart_spl_addon']) && $cart_item['_fkcart_spl_addon']==true) {
@xlplugins
xlplugins / reference_snippet_disable_upsell_specific_product.php
Created July 8, 2025 08:37
Disable upsell specific product reference snippet
class FKCart_Disable_Upsells {
public function __construct() {
add_action( 'fkcart_before_cart_items', [ $this, 'init_filters' ] );
}
public function init_filters() {
add_filter( 'woocommerce_product_get_upsell_ids', [ $this, 'remove_upsell_ids' ], 10, 2 );
add_filter( 'woocommerce_product_get_cross_sell_ids', [ $this, 'remove_cross_sell_ids' ], 10, 2 );
add_filter( 'fkcart_default_upsells', [ $this, 'remove_fkcart_default_upsells' ] );
@xlplugins
xlplugins / Dequeue our google map js
Created July 7, 2025 14:59
Dequeue our google map js
add_action( 'wp_enqueue_scripts', function () {
wp_dequeue_script( 'wfacp_google_js' );
}, 101 );
add_action( 'wp_footer', function () {
if(!is_checkout()){
return;
}
?>
<script>
window.addEventListener('load', function () {
@xlplugins
xlplugins / gist:823171a4197097d8062faa037b3a03bb
Created July 4, 2025 10:23
Make cart empty if user first open the dedicated Funnel Checkout page and left without placing an order
class FKCART_Trigger_Add_To_cart_On_Page_Load {
public function __construct() {
add_action( 'wp_footer', [ $this, 'add_js' ] );
add_filter('fkcart_re_run_get_slide_cart_ajax', '__return_true', 9999);
add_action( 'wp_head', [$this,'action'], 99999);
}
public function action() {
@xlplugins
xlplugins / Try to re render klarna paylater message on Single product page.
Created July 3, 2025 10:31
Try to re render klarna paylater message on Single product page.
class FKWCS_Klarna_message_div {
public function __construct() {
add_action( 'woocommerce_after_template_part', [ $this, 'render_paylater' ] );
add_action( 'wp_footer', [ $this, 'render_paylater_message_div' ], 99 );
}
public function render_paylater( $template_name ) {
if ( ( $template_name === 'single-product/add-to-cart/variable.php' || $template_name === 'single-product/add-to-cart/simple.php' ) && is_product() ) {
@xlplugins
xlplugins / gist:f1443f67aa7762d659b209749e9c9951
Created July 2, 2025 11:35
Funnelkit Checkout: add compatability with ShopLentor – WooCommerce Builder for Elementor & Gutenberg by HasThemes
class WFACP_Woolentor_Addon{
public function __construct() {
add_action( 'wfacp_checkout_page_found', [ $this, 'action' ], 15 );
}
public function action() {
$is_global_checkout = WFACP_Core()->public->is_checkout_override();
if(class_exists('Woolentor_Woo_Custom_Template_Layout_Pro') && false === $is_global_checkout) {
WFACP_Common::remove_actions('template_include','Woolentor_Woo_Custom_Template_Layout_Pro','change_page_template');
}
}
@xlplugins
xlplugins / reload or refresh funnelkit checkout page if product belong to other funnelkit checkout page
Last active July 10, 2025 12:59
"Automatically reload or redirect the FunnelKit checkout page if a product in the cart belongs to a different FunnelKit checkout funnel."
class WFACP_Checkout_Mismatch_Handler {
private $logger;
public function __construct() {
$this->logger = wc_get_logger();
add_filter( 'woocommerce_add_cart_item', [ $this, 'add_cart_item_checkout_page_id' ], 10 );
add_filter( 'woocommerce_update_order_review_fragments', [ $this, 'check_checkout_page_id_fragment' ] );
add_action( 'woocommerce_after_checkout_validation', [ $this, 'validate_checkout_page_match' ], 10, 2 );
@xlplugins
xlplugins / gist:284e828e116757a9f882ec68b4a257c0
Created July 1, 2025 12:41
Funnelkit Cart: Trigger add to cart when page load
class FKCART_Trigger_Add_To_cart_On_Page_Load {
public function __construct() {
add_action( 'wp_footer', [ $this, 'add_js' ] );
}
public function add_js() {
?>
<script>
window.addEventListener('load', function () {
jQuery(document.body).on('fkcart_cart_open', function () {
@xlplugins
xlplugins / gist:cc03eadd5afae86a2e90828d94cb0364
Created July 1, 2025 11:48
Funnelkit Checkout: Disabled Zoom and autofill update for billing email field
class WFACP_Billing_Email_Autofill_Disabled_zoom{
public function __construct() {
add_filter( 'wfacp_forms_field', [ $this, 'add_css_class' ], 99, 2 );
add_filter('wfacp_intial_scale_default','__return_true');
}
function add_css_class( $field, $key ) {
if ( $key !== 'billing_email' || !isset($field['autocomplete'])) {
return $field;
@xlplugins
xlplugins / snippet.php
Created June 30, 2025 10:28
Remove the frontend script a& metabox based on tracking settings
/**
* Conditionally removes the FunnelKit (WooFunnels) frontend tracking scripts.
*
* This function checks if the "Track UTMs" setting in FunnelKit's general settings
* is disabled. If it is, it removes the action responsible for enqueuing the
* e-commerce tracking scripts, preventing them from being loaded on the site's frontend.
*
* It hooks into 'wp_enqueue_scripts' with a very early priority (-1) to ensure
* it runs before the target action is executed.
*