Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / Create Klarna Element if not available on.
Created May 29, 2026 11:53
Create Klarna Element if not available on.
add_action( 'wp_footer', function() {
if ( ! is_product() && ! is_cart() && ! is_checkout() ) {
return;
}
?>
<script>
document.addEventListener('DOMContentLoaded', function() {
if (!document.getElementById('kec-pay-button')) {
var el = document.createElement('div');
el.id = 'kec-pay-button';
@xlplugins
xlplugins / kalvio newsletter subscribe
Created May 29, 2026 09:08
kalvio newsletter subscribe
<?php
/**
* Plugin Name: Plakatdyr — Klaviyo Consent Bridge for Aero Checkout
* Description: Ports the theme's newsletter consent checkbox (from woocommerce/checkout/form-coupon.php)
* into FunnelKit Aero (WFACP) checkout pages, so newsletter-terms reaches the backend on
* Aero orders too. Without this, Aero orders create Klaviyo profiles via the auto-tracking
* integration without consent flag → profile shows as Suppressed instead of Subscribed.
* Author: Plakatdyr Support
* Version: 1.0.0
*/
add_action( 'woocommerce_before_calculate_totals', function ( $cart ) {
if ( ! $cart instanceof WC_Cart || $cart->is_empty() ) {
return;
}
$contents = $cart->cart_contents;
if ( count( $contents ) < 2 ) {
return;
}
@xlplugins
xlplugins / choose_an_option_by_default.php
Last active May 27, 2026 11:14
choose an option by default on offer pages
add_filter( 'wfocu_show_default_variation_on_load', '__return_false' );
@xlplugins
xlplugins / Hide reward for listed countries
Last active June 1, 2026 08:51
Hide free shippig reward for listed countries
add_filter( 'fkcart_free_shipping', function ( $options ) {
if ( is_null( WC()->cart ) ) {
return false;
}
$location = WC_Geolocation::geolocate_ip( '', true, true );
$country = ! empty( $location['country'] ) ? strtoupper( $location['country'] ) : '';
if ( 'AU' !== $country ) {
@xlplugins
xlplugins / Hide a FunnelKit Cart reward unless the cart contains a product
Last active May 28, 2026 14:40
Hide a FunnelKit Cart reward unless the cart contains a product
/**
* FKCart category based free gift rewards.
* 1876 => carnes-del-corral
* 29711 => carnes-del-mar
*/
add_filter( 'fkcart_rewards_list', 'my_fkcart_category_rewards_list', 999 );
add_filter( 'fkcart_gift_products', 'my_fkcart_category_gift_products', 999, 2 );
add_action( 'wp_footer', function () {
@xlplugins
xlplugins / download plugin snippet
Created May 26, 2026 13:13
download plugin snippet
<?php
/**
* Plugin Name: WP ZIP Downloader
* Description: Download installed plugins and themes as ZIP files without ZipArchive.
* Version: 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@xlplugins
xlplugins / coupon discount inside the FunnelKit sliding cart
Created May 25, 2026 11:32
coupon discount inside the FunnelKit sliding cart
/**
* Show the cumulative coupon discount inside the FunnelKit sliding cart,
* just above the checkout button.
*/
add_action( 'fkcart_before_checkout_button', 'betterwood_fkcart_discount_anzeigen' );
function betterwood_fkcart_discount_anzeigen() {
if ( is_null( WC()->cart ) || WC()->cart->is_empty() ) {
return;
@xlplugins
xlplugins / override product link for fkcart
Last active May 25, 2026 11:07
override product link for fkcart
@xlplugins
xlplugins / Fix Google Map Auto Complete On Reload
Last active May 29, 2026 06:55
Fix Google Map Auto Complete On Reload
<?php
add_action('wp_footer', function () {
if ( ! function_exists('is_checkout') || ! is_checkout() ) return;
?>
<script>
(function ($) {
var attached = { billing: false, shipping: false };
function ready() {
return window.google && google.maps && google.maps.places;