Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / Express wallets specific shipping method
Created March 27, 2026 06:32
Express wallets specific shipping method
add_filter(
'wc_stripe_get_formatted_shipping_methods',
static function ( $methods ) {
if ( ! is_array( $methods ) ) {
return $methods;
}
foreach ( $methods as $m ) {
if ( ! empty( $m['id'] ) && 'flat_rate:13' === $m['id'] ) {
return array( $m );
}
@xlplugins
xlplugins / Reward & coupon according to currency
Created March 26, 2026 07:53
Reward & coupon according to currency
add_filter( 'fkcart_rewards_list', function ( $data ) {
if ( empty( $data['rewards'] ) || ! isset( $data['subtotal'] ) ) {
return $data;
}
$currency = function_exists( 'get_woocommerce_currency' ) ? get_woocommerce_currency() : '';
$subtotal = (float) $data['subtotal'];
// (discount = coupon reward, freegift = free gift reward).
$targets = [
@xlplugins
xlplugins / show crypto qr top of customer details
Created March 24, 2026 09:27
show crypto qr top of customer details
/** FunnelKit TY: print PayGate crypto block before Customer Details; avoid duplicate on woocommerce_before_thankyou. */
defined( 'ABSPATH' ) || exit;
/**
* @return object|null Gateway instance with before_thankyou_page, or null.
*/
function paygatedotto_wffn_ty_paygate_gw( $order ) {
if ( ! $order instanceof WC_Order ) {
return null;
}
@xlplugins
xlplugins / free shipping for specific checkout
Created March 23, 2026 12:00
free shipping for specific checkout
add_filter( 'woocommerce_package_rates', 'wfacp_force_free_shipping_on_funnel_pages', 100, 2 );
/**
* Filter shipping rates to force free shipping on target FunnelKit checkout pages.
*
* @param array $rates Available shipping rates.
* @param array $package Shipping package data.
*
* @return array Filtered shipping rates.
@xlplugins
xlplugins / Funnelkit Cart : Free Shipping min amount set based on the currency
Created March 23, 2026 05:56
Funnelkit Cart : Free Shipping min amount set based on the currency
add_filter( 'fkcart_free_shipping', function ( $options ) {
// Ensure $options is an array.
if ( false === $options ) {
$options = [];
}
// Get current store/order currency (works with multi-currency plugins that hook into WooCommerce).
$currency = get_woocommerce_currency();
@xlplugins
xlplugins / FunnelKit - trust_section on wfacp_after_gateway_list
Last active March 21, 2026 05:37
Order button above HTML Field
/**FunnelKit - trust_section on wfacp_after_gateway_list */
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
const WFACP_TRUST_ID = 'trust_section';
add_action( 'wfacp_after_template_found', function () {
static $d = false;
if ( $d || ! class_exists( 'WFACP_Common' ) || ! function_exists( 'wfacp_form_field' ) ) {
return;
@xlplugins
xlplugins / Checkout phone leading 0 for local numbers
Created March 20, 2026 07:32
Checkout phone leading 0 for local numbers
if ( ! function_exists( 'checkout_phone_local_zero_normalize_one' ) ) {
function checkout_phone_local_zero_normalize_one( $phone ) {
if ( ! is_string( $phone ) || $phone === '' ) {
return $phone;
}
$p = trim( $phone );
$p = str_replace( array( ' ', "\t", "\n", "\r", '-', '(', ')' ), '', $p );
if ( $p === '' ) {
return $phone;
}
@xlplugins
xlplugins / confirm_email_field_for_non_logged_in_users_only
Last active March 23, 2026 07:51
Confirm email field for no logged in users only
class Create_Confirm_Email_Field {
public $email_required_msg = '';
public $email_not_matched = '';
public $display_page = false;
public function __construct() {
// Run this feature only for guest users
if ( is_user_logged_in() ) {
@xlplugins
xlplugins / Reload issue with slide cart
Created March 13, 2026 15:00
Reload issue with slide cart
add_action( 'wp_enqueue_scripts', function() {
if ( ! apply_filters( 'fkcart_prevent_cart_reload', true ) ) {
return;
}
if ( is_cart() ) {
return;
}
$inline = <<<'JS'
(function($){
$(document).on('added_to_cart.wc-cart wc_update_cart.wc-cart', function(e){
@xlplugins
xlplugins / Reload issue with slide cart
Last active March 13, 2026 15:00
Reload issue with slide cart
add_action( 'wp_enqueue_scripts', function() {
if ( ! apply_filters( 'fkcart_prevent_cart_reload', true ) ) {
return;
}
if ( is_cart() ) {
return;
}
$inline = <<<'JS'
(function($){
$(document).on('added_to_cart.wc-cart wc_update_cart.wc-cart', function(e){