Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / Shipping Insurance Manager for WooCommerce running shimmer on change
Created April 8, 2026 09:09
Shipping Insurance Manager for WooCommerce running shimmer on change
add_action(
'wp_enqueue_scripts',
static function (): void {
if ( ! wp_script_is( 'wfacp_checkout_js', 'enqueued' ) ) {
return;
}
wp_add_inline_script(
'wfacp_checkout_js',
<<<'JS'
@xlplugins
xlplugins / Funnelkit menu for only admin
Created April 8, 2026 07:25
Funnelkit menu for only admin
function fk_funnelkit_admin_only_caps( $funnel_user, $all_roles ) {
unset( $funnel_user, $all_roles );
$rw = array( 'read', 'write' );
return array(
'administrator' => array(
'menu' => $rw,
'funnel' => $rw,
'analytics' => $rw,
@xlplugins
xlplugins / allow only adminstrator role fk menu
Created April 8, 2026 07:09
allow only adminstrator role fk menu
add_filter( 'wffn_user_access_capabilities', 'wffn_funnel_user_capabilities', 10, 1 ); // funnel
add_filter( 'wfacp_user_access_capabilities', 'wffn_funnel_user_capabilities', 10, 1 ); // checkout
add_filter( 'wfocu_user_access_capabilities', 'wffn_funnel_user_capabilities', 10, 1 ); // upsell
add_filter( 'wfob_user_access_capabilities', 'wffn_funnel_user_capabilities', 10, 1 ); // bump
add_filter( 'bwfabt_user_access_capabilities', 'wffn_funnel_user_capabilities', 10, 1 ); // experiment
add_filter( 'fkcart_user_access_capabilities', 'wffn_funnel_user_capabilities', 10, 1 ); // cart
function wffn_funnel_user_capabilities( $config ) {
if ( is_array( $config ) ) {
// Allow ONLY administrator
@xlplugins
xlplugins / Loader Full page
Created April 7, 2026 06:51
Loader Full page
class ChangeBlockUI {
public $overlay_text = 'Processing';
public function __construct() {
add_action( 'wfacp_after_checkout_page_found', [ $this, 'remove_actions' ] );
add_action( 'wfacp_internal_css', [ $this, 'internal_css' ] );
}
@xlplugins
xlplugins / FunnelKit PayPal + WooCommerce PayPal Payments sdk conflict
Last active April 1, 2026 09:50
FunnelKit PayPal + WooCommerce PayPal Payments sdk conflict
/**
* Plugin Name: FunnelKit PayPal + WooCommerce PayPal Payments — single SDK
* Description: Optional fix when both plugins load PayPal JS SDK: removes the duplicate sdk/js tag and rewires FunnelKit script deps to PPCP’s loader.
*
* PayPal allows one https://www.paypal.com/sdk/js include per page. Two tags break window.paypal
* (e.g. PPCP: "getFundingSources is not a function").
*
* @package FunnelKit_PayPal_PPCP_Compat
*/
@xlplugins
xlplugins / WeddingTropics theme
Created April 1, 2026 06:40
WeddingTropics theme
<?php
/**
* Dequeue conflicting WeddingTropics theme assets on FunnelKit Checkout page
*/
add_action( 'init', function() {
if ( ! class_exists( 'Custom_FunnelKit_Dequeue' ) ) {
class Custom_FunnelKit_Dequeue {
@xlplugins
xlplugins / WeddingTropics theme
Created April 1, 2026 06:40
WeddingTropics theme
<?php
/**
* Dequeue conflicting WeddingTropics theme assets on FunnelKit Checkout page
*/
add_action( 'init', function() {
if ( ! class_exists( 'Custom_FunnelKit_Dequeue' ) ) {
class Custom_FunnelKit_Dequeue {
@xlplugins
xlplugins / Run_custom_script_just_after_start_of_body_tag.php
Created March 30, 2026 13:17
Run custom script just after start of body tag on all funnel and site pages.php
add_action( 'wp_body_open', 'load_custom_js_below_body' );
function load_custom_js_below_body() {
?>
<script>
console.log('Script loaded just below body tag');
</script>
<?php
}
@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 = [