Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / Greenshift-FunnelKit CSS Fix
Created February 3, 2026 07:24
Greenshift + FunnelKit CSS Fix
add_action( 'wfacp_checkout_page_found', function( $wfacp_id ) {
// Only run if Greenshift is active
if ( ! function_exists( 'gspb_get_final_css' ) ) {
return;
}
// Get queried object ID (WooCommerce checkout page)
$queried_id = get_queried_object_id();
// If they're the same, Greenshift will handle it
@xlplugins
xlplugins / Hide billing address section when cart total is zero (free products)
Created February 2, 2026 12:42
Hide billing address section when cart total is zero (free products)
<?php
/**
* Hide billing address section when cart total is zero (free products)
*/
$hide_billing_init = function() {
static $done = false;
if ( $done ) return;
$done = true;
@xlplugins
xlplugins / Hide billing address section when cart total is zero (free products)
Created February 2, 2026 12:42
Hide billing address section when cart total is zero (free products)
<?php
/**
* Hide billing address section when cart total is zero (free products)
*/
$hide_billing_init = function() {
static $done = false;
if ( $done ) return;
$done = true;
@xlplugins
xlplugins / Elesse theme conflict with fkcart
Created February 2, 2026 11:47
Elesse theme conflict with fkcart
add_action( 'wp_footer', function () {
?>
<script>
(function($) {
$(document.body).on('fkcart_cart_quick_view_open', function() {
setTimeout(function() {
var $form = $('.fkcart-drawer-content .variations_form');
if ($form.length && typeof $.fn.nasa_attr_ux_variation_form === 'function') {
$form.removeClass('nasa-attr-ux-form').addClass('nasa-attr-ux-form');
$form.nasa_attr_ux_variation_form();
@xlplugins
xlplugins / Add shipping in upsell with filter in batching scenrios
Created February 2, 2026 08:30
Add shipping in upsell with filter in batching scenrios
// To enable override (charge full shipping):
add_filter( 'wfocu_dynamic_shipping_override', '__return_true' );
// To add shipping to subscriptions:
add_filter( 'wfocu_subscription_args', function( $args, $get_product, $product, $subscription_order ) {
$args['add_shipping'] = true;
return $args;
}, 10, 4 );
@xlplugins
xlplugins / Add shipping in upsell with filter in batching scenrios
Created February 2, 2026 08:30
Add shipping in upsell with filter in batching scenrios
// To enable override (charge full shipping):
add_filter( 'wfocu_dynamic_shipping_override', '__return_true' );
// To add shipping to subscriptions:
add_filter( 'wfocu_subscription_args', function( $args, $get_product, $product, $subscription_order ) {
$args['add_shipping'] = true;
return $args;
}, 10, 4 );
@xlplugins
xlplugins / Uk-address—locality-mapping
Created February 2, 2026 07:50
uk address locality mapping with google address
<?php
add_action( 'wfacp_after_checkout_page_found', function () {
add_action( 'wp_footer', function () {
?>
<script>
window.addEventListener('load', function () {
(function ($) {
function extractValueByType(components, typeKey, nameType = 'long_name') {
const match = components.find(comp => comp.types.includes(typeKey));
@xlplugins
xlplugins / FK Stripe : logo change for clearpay afterpay
Created January 30, 2026 10:26
FK Stripe : logo change for clearpay afterpay
add_filter( 'fkwcs_stripe_payment_icons', function( $icons ) {
// Use an external image URL
$icons['afterpay_clearpay'] = '<img src="https://example.com/path/to/your-clearpay-icon.svg" class="stripe-afterpay-icon stripe-icon" alt="afterpay" style="width:auto;height:24px" />';
return $icons;
@xlplugins
xlplugins / gist:775573f2653d63bba22d83808a76d8ba
Created January 28, 2026 10:08
Funnelkit Checkout: Hide Billing Address Fields When Cart Total is Zero
class WFACP_Hide_Billing_Fields_On_Zero_Cart {
protected $field_key = 'billing';
public function __construct() {
add_action( 'wfacp_before_process_checkout_template_loader', [ $this, 'init' ] );
add_action( 'wfacp_after_checkout_page_found', [ $this, 'init' ] );
}
/**
* Initialize hooks
@xlplugins
xlplugins / Trust-payments-fk-checkout-compatibility
Created January 28, 2026 07:49
Trust Payments + FunnelKit Checkout Compatibility Snippet
<?php
/**
* Trust Payments + FunnelKit Checkout Compatibility Snippet
*
* Fixes two issues when using Trust Payments gateway with FunnelKit Checkout:
* 1. "Form with id: 'st-form' does not exist" - SDK expects st-form but FunnelKit uses wfacp_checkout_form
* 2. "Invalid card details" validation error - tp_valid_card_detail hidden field missing from form
*
* Usage: Add this code to your theme's functions.php or a custom plugin.
*