Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / fkcart-rewards-on-cart-page.php
Created November 4, 2026 13:34
FunnelKit Cart: show the reward progress bar on the WooCommerce cart page
<?php
/**
* FunnelKit Cart: show the reward progress bar on the WooCommerce cart page, kept in sync with the slide cart.
*
* Renders FunnelKit Cart's own rewards template above the cart table and adds it to FunnelKit Cart's
* fragments, so every slide cart refresh replaces it too. Changes made on the cart page itself
* (quantity, coupon) ask FunnelKit Cart to refresh.
*/
function fk_cart_page_rewards_html() {
@xlplugins
xlplugins / Fkwcs_prevent_save_cart_ec.php
Last active November 4, 2026 10:58
/** * FunnelKit Stripe: don't save the card for Google Pay / Apple Pay payments. * * Wallet payments are sent as one-time payments (no setup_future_usage=off_session), so banks * ask for 3D Secure less often. Card payments and subscription orders still save the card. * A wallet order has no saved card to charge again, so its one-click upsell is …
<?php
/**
* FunnelKit Stripe: don't save the card for Google Pay payments.
*
* Google Pay payments are sent as one-time payments (no setup_future_usage=off_session), so banks
* ask for 3D Secure less often. Apple Pay, card payments and subscription orders still save the card.
* A Google Pay order has no saved card to charge again, so its one-click upsell is skipped.
*/
function fk_wallet_no_save_is_wallet_order( $order ) {
@xlplugins
xlplugins / Order bump discount on the first payment only
Created October 27, 2026 15:21
Sublium : Order bump discount on the first payment only
/**
* Plugin Name: Sublium - Order bump discount on the first payment only
* Description: A Funnel Builder order bump discount on a subscription product applies to the first payment only. Every renewal, whatever the billing frequency, is charged at the full plan price.
* Version: 1.0.0
*
* Install as a must-use plugin (wp-content/mu-plugins/) or as a Code Snippets entry
* (everything below the opening tag, run everywhere).
*
* How it works
* - Sublium stores the discounted price on the subscription at purchase time and
@xlplugins
xlplugins / showing choose plan inside the plan selector
Created October 27, 2026 11:11
showing choose plan inside the plan selector
<?php
/**
* Plugin Name: Sublium Choose Plan Label (test)
* Description: Shows "Choose Plan" in the Sublium plan-selector trigger box and, when the Subscription option is active but no plan has been picked, blocks add-to-cart and shows a "Please select a subscription plan." message instead of silently disabling the button.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@xlplugins
xlplugins / FunnelKit phone trace (temporary). Logs
Created October 26, 2026 10:38
FunnelKit phone trace (temporary). Logs
<?php
/**
* FunnelKit phone trace (temporary). Logs, for express wallet orders only, the billing/shipping phone
* at each step from the wallet to WooCommerce's validation, with every digit masked as "9".
* Log: WooCommerce > Status > Logs > source "fk-phone-trace".
*/
add_action( 'woocommerce_before_checkout_process', function () {
if ( empty( $_POST['payment_request_type'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
return; // Not an express wallet order.
}
@xlplugins
xlplugins / allow woocommerce product bundle type in upsell
Created October 23, 2026 07:29
allow woocommerce product bundle type in upsell
add_filter(
'wfocu_offer_product_types',
function ( $types ) {
// Only expose bundles when WooCommerce Product Bundles is actually active.
if ( class_exists( 'WC_Product_Bundle' ) && ! in_array( 'bundle', (array) $types, true ) ) {
$types[] = 'bundle';
}
return $types;
}
);
@xlplugins
xlplugins / change cron timing to 10 min to 5 min in sublium
Created October 22, 2026 11:06
change cron timing to 10 min to 5 min in sublium
<?php
/**
* Plugin Name: Sublium - Renewal check every 5 minutes
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_filter(
@xlplugins
xlplugins / change_product_id.php
Created October 21, 2026 14:30
change product ID's
function fk_merchant_center_id( $content_id, $product_id ) {
$map = array(
11487 => 'KLW', // KLOW
12092 => 'ss', // SS-31
7466 => '5157472594', // Glutathione
);
return isset( $map[ $product_id ] ) ? $map[ $product_id ] : $content_id;
}
add_filter( 'wffn_get_product_content_id', 'fk_merchant_center_id', 10, 2 ); // purchase + sitewide events
add_filter( 'wfocu_get_product_content_id', 'fk_merchant_center_id', 10, 2 ); // upsell purchases
@xlplugins
xlplugins / FunnelKit Stripe – Show express buttons when ready
Created October 21, 2026 13:42
FunnelKit Stripe – Show express buttons when ready
add_action( 'wp_head', function () {
if ( ! function_exists( 'is_checkout' ) || ! is_checkout() ) {
return;
}
?>
<script>
( function () {
/* Shared bootstrap (same in both FunnelKit Stripe express snippets): lets each snippet hook express buttons. */
window.fkwcsExpressHooks = window.fkwcsExpressHooks || [];
if ( ! window.fkwcsExpressHooksReady ) {
@xlplugins
xlplugins / FunnelKit Stripe – Retry Google Pay express button
Created October 21, 2026 13:41
FunnelKit Stripe – Retry Google Pay express button
<?php
/**
* Plugin Name: FunnelKit Stripe – Retry Google Pay express button
* On checkout, if Stripe first reports Google Pay unavailable, retry that button once
* before FunnelKit Stripe hides it.
* Add with the Code Snippets plugin (Run everywhere). Works alone or with "Show express buttons when ready".
*/
add_action( 'wp_head', function () {
if ( ! function_exists( 'is_checkout' ) || ! is_checkout() ) {
return;