Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / Blank Chem Theme + FunnelKit Checkout Compat
Last active May 15, 2026 08:28
Blank Chem Theme + FunnelKit Checkout Compat
add_filter( 'pre_do_shortcode_tag', function ( $override, $tag ) {
if ( 'woocommerce_checkout' !== $tag || ! is_page( 'checkout' ) || ! class_exists( 'WFACP_Common' ) ) {
return $override;
}
$post = get_post( WFACP_Common::get_id() );
return $post ? do_shortcode( do_blocks( $post->post_content ) ) : $override;
}, 10, 2 );
@xlplugins
xlplugins / order summary , coupon above place order
Last active May 13, 2026 15:37
order summary , coupon above place order
<?php
/**
* Move Order Summary + Coupon above the Place Order button on WFACP Elementor checkout.
* Place Order button and all other elements stay exactly where they are.
*/
class Pvst_Order_Summary_Position_Above_PlaceOrder_Elementor {
public function __construct() {
add_action( 'wfacp_after_checkout_page_found', [ $this, 'enabled_term_condition' ] );
add_filter( 'woocommerce_checkout_posted_data', [ $this, 'remove_validation' ], 60 );
@xlplugins
xlplugins / vat numeber field accoridng to customer_type
Created May 13, 2026 14:40
vat numeber field accoridng to customer_type
add_action( 'wp_footer', function () {
if ( ! function_exists( 'is_checkout' ) || ! is_checkout() ) {
return;
}
?>
<script>
jQuery(function ($) {
function syncVatRequired() {
var required = $('#customer_type').val() === 'azienda';
var $field = $('#vat_number_field');
@xlplugins
xlplugins / discount_on_checkout_based_on_specific_product_category.php
Created May 13, 2026 13:31
discount on checkout based on specific product category
add_action( 'woocommerce_cart_calculate_fees', 'fk_multi_category_discount', 20, 1 );
function fk_multi_category_discount( $cart ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return;
// -------------------------------------------------------
// CONFIGURATION — Add as many categories as needed
// category_id/slug => discount percentage
// -------------------------------------------------------
@xlplugins
xlplugins / fk_cart_free_gift_restore.php
Created May 7, 2026 12:46
Restore strikethrough HTML for FunnelKit Cart free-gift / reward items
<?php
/**
* Restore strikethrough HTML for FunnelKit Cart free-gift / reward items
* when "WooCommerce Product Batch Expiry Tracking and Notifications" is active.
*
* The batch plugin filters woocommerce_cart_item_subtotal at priority 9999
* with an unconditional wc_price() call that wipes the <del>/<ins> markup
* the rewards system produces. We re-apply the strikethrough at a higher
* priority — but only for cart lines flagged as free gifts.
*/
@xlplugins
xlplugins / Saved Addresses Trigger Fk checkout Field Change Events
Created May 6, 2026 12:34
Saved Addresses Trigger Fk checkout Field Change Events
/**
* Plugin Name: Saved Addresses → Trigger Field Change Events
* Description: The "Saved Addresses for WooCommerce" plugin auto-fills checkout
* address fields via jQuery .val() but never triggers input/change
* events. That breaks floating-label libraries (labels stay in
* their empty-state position over the filled value), WC's
* update_checkout listeners, and any third-party validators bound
* to those fields. This snippet listens for the plugin's two AJAX
* actions and dispatches input/change/keyup/blur on every populated
* billing & shipping field after the response handler finishes.
@xlplugins
xlplugins / express as inline in payment method list
Last active May 7, 2026 13:12
express as inline in payment method list
/**
* FunnelKit Stripe + FunnelKit PayPal — render the inline express-button
* (Google Pay / Apple Pay / PayPal) inside the payment-method <li> instead
* of beside the WooCommerce Place Order button.
*
* Drop into a child theme's functions.php, an mu-plugin file, or Code Snippets.
*/
add_action( 'fkwcs_stripe_apple_pay_after_payment_field_checkout', static function () {
echo '<div class="fkwcs_stripe_apple_pay_button fkwcs-inline-relocated"></div>';
@xlplugins
xlplugins / FK Uncode Variation Gallery Bridge
Created May 5, 2026 11:47
FK Uncode Variation Gallery Bridge
@xlplugins
xlplugins / Funnelkit Checkout Bankful payment plugin comaptibility
Created April 30, 2026 09:26
Funnelkit Checkout Bankful payment plugin comaptibility
function shoptimizer_child_bankful_hosted_direct_redirect( $url, $order ) {
if ( ! function_exists( 'WC' ) || ! WC()->payment_gateways() ) {
return $url;
}
if ( ! $order instanceof WC_Order ) {
return $url;
}
if ( 'bankful_hosted_gateway' !== $order->get_payment_method() ) {
return $url;
}
@xlplugins
xlplugins / customer new param in capi events
Created April 28, 2026 15:29
customer new param in capi events
<?php
defined( 'ABSPATH' ) || exit;
add_filter(
'wffn_ecomm_tracking_fb_params',
static function ( $data, $order = null ) {
if ( ! $order instanceof WC_Order ) {
return $data;
}