Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / blocksy theme compatibility with slide cart
Created February 13, 2026 15:26
blocksy theme compatibility with slide cart
add_action( 'wp_footer', function () {
?>
<script>
(function($) {
function updateSwatchLabel(form) {
$(form).find('.ct-variation-swatches').each(function() {
var sel = this.querySelector('select');
if (!sel) return;
var attr = (sel.dataset.attribute_name || '').replace('attribute_', '');
var val = sel.value;
@xlplugins
xlplugins / FunnelKit Cart: Exclude Bundled Product Upsells
Created February 11, 2026 15:01
FunnelKit Cart: Exclude Bundled Product Upsells
/**
* Exclude bundled product upsells from cart "Frequently Bought Together".
* Drop this in wp-content/mu-plugins/ or add to theme functions.php.
*
* Requires: WooCommerce Product Bundles + FunnelKit Cart + fkcart_upsell_ids filter in upsells.php
*/
add_filter( 'fkcart_upsell_ids', function ( $upsell_ids ) {
if ( ! WC()->cart || empty( $upsell_ids ) ) {
return $upsell_ids;
}
@xlplugins
xlplugins / Show Choose an option in Mini cart
Created February 11, 2026 13:59
Show Choose an option in Mini cart
add_filter( 'wfacp_show_select_option_link_mini_cart', '__return_true' );
@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
Last active February 9, 2026 13:24
Elesse theme conflict with fkcart
add_action( 'wp_head', function () {
?>
<style>
.fkcart-drawer-content .nasa-buy-now,
.fkcart-drawer-content input[name="nasa_buy_now"] {
display: none !important;
}
</style>
<?php
}, 999 );
@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));