Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / Disable new user creation email during the checkout if cart contain sublium subscription
Created May 19, 2026 06:17
Disable new user creation email during the checkout if cart contain sublium subscription
add_filter( 'woocommerce_email_enabled_customer_new_account', function( $enabled, $object ) {
      // Check if we're in a checkout/order processing context with a Sublium plan in cart
      if ( WC()->cart && \Sublium_WCS\Includes\Main\Cart::get_instance()->cart_contains_plan() ) {
          return false;
      }
      return $enabled;
  }, 10, 2 );
@xlplugins
xlplugins / exclude reward for specific product category
Created May 18, 2026 13:24
exclude reward for specific product category
add_filter( 'fkcart_reward_rules_checking', function ( $skip, $reward ) {
if ( 'freegift' !== strval( $reward['type'] ) || ! WC()->cart ) {
return $skip;
}
foreach ( WC()->cart->get_cart() as $item ) {
if ( ! empty( $item['_fkcart_free_gift'] ) ) {
continue;
}
$id = ! empty( $item['variation_id'] ) ? wp_get_post_parent_id( $item['variation_id'] ) : $item['product_id'];
if ( $id && has_term( 'gift-card', 'product_cat', $id ) ) {
@xlplugins
xlplugins / Show Signup Fee as Offer Price (Lifetime Subscriptions)
Created May 18, 2026 07:20
Show Signup Fee as Offer Price (Lifetime Subscriptions)
<?php
/**
* Plugin Name: WFOCU - Show Signup Fee as Offer Price (Lifetime Subscriptions)
* Description: For products flagged lifetime by "Lifetime Subscriptions for WooCommerce", display the signup fee as the offer price and hide the signup / recurring rows.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@xlplugins
xlplugins / FK Bricks — Mini-cart fragment fix
Created May 15, 2026 12:40
FK Bricks — Mini-cart fragment fix
add_filter( 'woocommerce_update_order_review_fragments', function ( $fragments ) {
if ( ! class_exists( 'WFACP_Common' ) || ! defined( 'BRICKS_DB_PAGE_CONTENT' ) ) {
return $fragments;
}
$tpl = wfacp_template();
if ( ! $tpl ) {
return $fragments;
}
foreach ( (array) get_post_meta( WFACP_Common::get_id(), BRICKS_DB_PAGE_CONTENT, true ) as $el ) {
if ( ( $el['name'] ?? '' ) === 'wfacp-order-summary' && ! empty( $el['id'] ) ) {
@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.