Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / Sublium : Split a fixed recurring coupon across installments
Last active November 10, 2026 12:17
Sublium : Split a fixed recurring coupon across installments
/**
* Plugin Name: Sublium - Split a fixed recurring coupon across installments
* Description: Divides a Sublium Recurring Product Discount coupon by the number of installments when the product is bought on an installment plan. One-time purchases still get the full amount.
* Version: 1.0.0
*
* Example: a $997 product, sold outright or as 3 payments of $347, with a $30
* "Sublium Recurring Product Discount" coupon:
* One-time purchase -> $30 off, $967 (unchanged; Sublium already does this).
* 3 x $347 -> $10 off each payment, 3 x $337 (Sublium alone takes $30 off each).
* Down payment, then 3 x $347 -> deposit unchanged, then 3 x $337.
@xlplugins
xlplugins / fkcart-give-only-highest-unlocked-reward.php
Created November 10, 2026 08:48
FunnelKit Cart — Give Only the Highest Unlocked Reward
<?php
/**
* FunnelKit Cart — Give Only the Highest Unlocked Reward
*
* By default, when a cart crosses several reward milestones, every unlocked
* reward applies together (multiple free gifts / multiple discount coupons).
* With this snippet only the highest milestone reached applies, per reward
* type: the highest gift milestone adds its gift and the highest discount
* milestone applies its coupon. Lower tiers are removed automatically and
* come back if the cart total drops below a tier. Free shipping milestones
@xlplugins
xlplugins / Cancel the subscription in case of Renewal order failed order cancelled by customer at my account
Last active November 9, 2026 12:42
Cancel the subscription in case of Renewal order failed order cancelled by customer at my account
if ( ! class_exists( 'Audima_Cancel_Subscription_On_Renewal_Order_Cancel' ) ) {
/**
* Cancels the related Sublium subscription when the customer cancels its failed/pending renewal
* order from My Account.
*
* We listen on woocommerce_cancelled_order, which is intrinsically customer-initiated (it fires
* only from WC_Form_Handler::cancel_order()), instead of inferring the actor from
* is_admin()/current_user, which misfires under Action Scheduler (admin-ajax) and during a
* logged-in customer's background requests.
@xlplugins
xlplugins / hide-customs-hs-origin-funnelkit-checkout-cart.php
Created November 6, 2026 13:50
Hide HS Code & Country of Origin on Cart, Slide Cart & Checkout
<?php
/**
* Hide HS Code & Country of Origin on Cart, Slide Cart & Checkout
*
* Works with: Customs Fees for WooCommerce + FunnelKit Funnel Builder / FunnelKit Cart
*
* The Customs Fees for WooCommerce plugin appends each product's HS code and
* country of origin to the item display in the cart and checkout. This snippet
* removes only that display — customs fees are still calculated as usual, and
* the HS code / origin still appear on orders, emails, and in the admin.
@xlplugins
xlplugins / $3 fee per instalments
Created November 5, 2026 14:39
$3 fee per instalments
if ( ! class_exists( 'Sublium_Installment_Fee' ) ) {
/**
* Applies a per-installment fee across the three order paths: initial checkout, renewal, payoff.
*/
class Sublium_Installment_Fee {
/**
* The fee charged on each installment payment. Change this one value.
*/
@xlplugins
xlplugins / FunnelKit One Click Upsells - custom Mollie upsell payment description
Created November 5, 2026 08:57
FunnelKit One Click Upsells - custom Mollie upsell payment description
<?php
/**
* FunnelKit One Click Upsells - custom Mollie upsell payment description
*
* Changes the text Mollie shows on the customer's bank statement for the upsell charge
* (SEPA Direct Debit / card via mandate, and iDEAL redirect upsells).
* Uses the main WooCommerce order number, translated by the store language.
*
* Requires FunnelKit Funnel Builder Pro with the wfocu_mollie_upsell_payment_description filter.
*/
@xlplugins
xlplugins / Order-bump-dynamic-sku-addon.php
Created November 5, 2026 07:35
/** * Plugin Name: Order Bump - dynamic SKU add-on * Description: Offers the add-on that matches each cart product's SKU, so one bump covers every * product instead of one bump per product. The cart product stays; the add-on is added. * Set the bump's action to "Add" (not "Replace"). */
<?php
/**
* Plugin Name: Order Bump - dynamic SKU add-on
* Description: Offers the add-on that matches each cart product's SKU, so one bump covers every
* product instead of one bump per product. The cart product stays; the add-on is added.
* Set the bump's action to "Add" (not "Replace").
*/
defined( 'ABSPATH' ) || exit;
@xlplugins
xlplugins / fkcart-rewards-on-cart-page.php
Created November 4, 2026 13:34
FunnelKit Cart: show the reward progress bar on the WooCommerce cart page
<?php
/**
* FunnelKit Cart: show the reward progress bar on the WooCommerce cart page, kept in sync with the slide cart.
*
* Renders FunnelKit Cart's own rewards template above the cart table and adds it to FunnelKit Cart's
* fragments, so every slide cart refresh replaces it too. Changes made on the cart page itself
* (quantity, coupon) ask FunnelKit Cart to refresh.
*/
function fk_cart_page_rewards_html() {
@xlplugins
xlplugins / Fkwcs_prevent_save_cart_ec.php
Last active November 4, 2026 10:58
/** * FunnelKit Stripe: don't save the card for Google Pay / Apple Pay payments. * * Wallet payments are sent as one-time payments (no setup_future_usage=off_session), so banks * ask for 3D Secure less often. Card payments and subscription orders still save the card. * A wallet order has no saved card to charge again, so its one-click upsell is …
<?php
/**
* FunnelKit Stripe: don't save the card for Google Pay payments.
*
* Google Pay payments are sent as one-time payments (no setup_future_usage=off_session), so banks
* ask for 3D Secure less often. Apple Pay, card payments and subscription orders still save the card.
* A Google Pay order has no saved card to charge again, so its one-click upsell is skipped.
*/
function fk_wallet_no_save_is_wallet_order( $order ) {
@xlplugins
xlplugins / Order bump discount on the first payment only
Created October 27, 2026 15:21
Sublium : Order bump discount on the first payment only
/**
* Plugin Name: Sublium - Order bump discount on the first payment only
* Description: A Funnel Builder order bump discount on a subscription product applies to the first payment only. Every renewal, whatever the billing frequency, is charged at the full plan price.
* Version: 1.0.0
*
* Install as a must-use plugin (wp-content/mu-plugins/) or as a Code Snippets entry
* (everything below the opening tag, run everywhere).
*
* How it works
* - Sublium stores the discounted price on the subscription at purchase time and