Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / Show strike-through price for subscription product in fkcart
Created March 6, 2026 14:48
Show strike-through price for subscription product in fkcart
/**
* Snippet: Show strike-through price and "Save X%" for subscription products in Cart for WooCommerce
* Add to theme functions.php or Code Snippets.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_filter( 'fkcart_disable_strike_price_product_type', function ( $excluded_types ) {
return array_diff( $excluded_types, [ 'subscription', 'variable-subscription', 'subscription_variation' ] );
@xlplugins
xlplugins / Tax Switch for WooCommerce cart compatibility
Created March 5, 2026 13:18
Tax Switch for WooCommerce cart compatibility
/**
* Plugin Name: FKCart Tax Switch Suppress
* Description: Hides Tax Switch dual price (incl/excl VAT) only in the cart icon/menu.
* Keeps it active in the cart modal, product pages, etc.
* Uses FKCart's native hooks - no backtrace.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@xlplugins
xlplugins / refresh checkout on session expiry
Last active March 5, 2026 09:37
refresh checkout on session expiry
/**
* If update_order_review returns and woocommerce_cart_hash cookie is not found → refresh checkout once.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'wp_footer', 'keep_wc_session_refresh_script', 20 );
function keep_wc_session_refresh_script() {
@xlplugins
xlplugins / razzi theme login form
Created March 5, 2026 07:25
razzi theme login form
/**
* Plugin Name: WFACP + Razzi: Suppress Duplicate Login
* Description: Removes Razzi's native login/coupon block on FunnelKit checkout (PHP compatibility).
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'wfacp_after_checkout_page_found', function () {
@xlplugins
xlplugins / razzi theme login form
Created March 5, 2026 07:25
razzi theme login form
/**
* Plugin Name: WFACP + Razzi: Suppress Duplicate Login
* Description: Removes Razzi's native login/coupon block on FunnelKit checkout (PHP compatibility).
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'wfacp_after_checkout_page_found', function () {
@xlplugins
xlplugins / FKCart WooRewards (Loyalty)
Last active March 3, 2026 08:09
FKCart WooRewards (Loyalty)
// Load WR assets on all pages (plugin normally only loads on cart/checkout)
add_action( 'wp_enqueue_scripts', function() {
if ( is_admin() || ( function_exists( 'is_checkout' ) && is_checkout() ) ) {
return;
}
if ( ! class_exists( '\FKCart\Includes\Data' ) || ! \FKCart\Includes\Data::is_cart_enabled( 'all' ) ) {
return;
}
if ( ! defined( 'LWS_WOOREWARDS_VERSION' ) ) {
@xlplugins
xlplugins / global order bump according to checkout id
Last active March 5, 2026 14:09
global order bump according to checkout id
/**
* Plugin Name: Order Bump - Show by Page ID
* Description: Bump 1576 on page 10, bump 2910 on page 2906.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_filter( 'wfob_filter_final_bumps', function( $final_bumps, $posted_data ) {
$page_id = 0;
if ( function_exists( 'wc_get_page_id' ) && function_exists( 'is_checkout' )) {
@xlplugins
xlplugins / custom checkbox for offer page
Last active March 5, 2026 09:49
custom checkbox for offer page
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$allowed_offer_ids = array( 13079277 );
$wfocu_offer_checkbox_callback = function() use ( $allowed_offer_ids ) {
static $done = false;
if ( $done ) {
@xlplugins
xlplugins / FKCart + woo discount rules - Coupon 0.00 Fix
Last active February 24, 2026 13:14
FKCart + Discount Rules for WooCommerce - Coupon 0.00 Fix
if ( ! defined( 'ABSPATH' ) ) exit;
add_filter( 'woocommerce_coupon_discount_amount_html', function( $h, $c ) {
if ( ! $c || ! WC()->cart || (float) WC()->cart->get_coupon_discount_amount( $c->get_code(), WC()->cart->display_cart_ex_tax ) > 0 ) return $h;
$code = strtolower( $c->get_code() ); $m = \Wdr\App\Controllers\ManageDiscount::class;
$v = $m::$apply_as_coupon_values[ $code ]['value'] ?? null;
if ( $v === null ) foreach ( $m::$applied_cart_coupon_discounts ?? [] as $x ) { if ( strtolower( $x['name'] ?? '' ) === $code ) { $v = $x['value']; break; } }
if ( $v === null && count( WC()->cart->get_applied_coupons() ) === 1 ) {
$v = 0;
@xlplugins
xlplugins / fKCart Rewards - Total Fallback
Created February 24, 2026 09:53
fKCart Rewards - Total Fallback
add_filter( 'fkcart_reward_total', 'fkcart_rewards_total_fallback', 999, 3 );
function fkcart_rewards_total_fallback( $total, $calculation_mode, $front ) {
if ( 'total' !== $calculation_mode ) {
return $total;
}
if ( is_null( WC()->cart ) || WC()->cart->is_empty() ) {
return $total;
}
// Only fallback when total is 0 or negative but cart has items