Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / Funnelkit Cart: Compatbility with woodmart Lazy load cart
Last active April 24, 2025 15:06
Funnelkit Cart: Compatbility with woodmart Lazy load cart
class FKCART_Woodmart_Theme_Lazy_Load {
public function __construct() {
add_action( 'wp_footer', [ $this, 'js' ] );
}
public function js() {
?>
<script id='funnelkit_cart_script' defer>
window.addEventListener('DOMContentLoaded', function () {
@xlplugins
xlplugins / gist:9260dca2fffc8d0908cc024735582a7a
Created April 23, 2025 12:50
Funnelkit Checkout: Compatability with plugin WooCommerce international phone input by Alex Masliychuk (alex91ckua)
class WFACP_WooCommerce_International_Phone_Input {
public function __construct() {
add_action( 'wfacp_after_checkout_page_found', [ $this, 'action' ] );
}
public function action() {
if ( ! $this->is_enabled() ) {
return;
}
@xlplugins
xlplugins / update funnelkit cart cookie using fragment
Created April 23, 2025 12:24
update funnelkit cart cookie using fragment
@xlplugins
xlplugins / Enable 0 discounting on Regular Price
Created April 23, 2025 11:15
Enable 0 discounting on Regular Price
class WFACP_Enable_zero_discount {
private $item;
private $regular_price = 0;
public function __construct() {
add_filter( 'wfacp_allow_zero_discounting', [ $this, 'allow_zero_discount' ], 10, 2 );
add_filter( 'wfacp_discount_regular_price_data', [ $this, 'get_regular_price' ] );
add_filter( 'wfacp_discount_price_data', [ $this, 'set_regular_price' ] );
}
@xlplugins
xlplugins / disallow_tokenization.php
Last active April 23, 2025 11:05
Disallow funnelkit stripe to save cards
/**
* Disallow funnelkit stripe to save cards
**/
add_filter('fkwcs_should_save_card',function( $save_card, $order) {
$order_id = $order->get_id();
$save_card = ( function_exists( 'wcs_order_contains_subscription' ) && ( wcs_order_contains_subscription( $order_id ) || wcs_is_subscription( $order_id ) || wcs_order_contains_renewal( $order_id ) ) );
return $save_card;
});
@xlplugins
xlplugins / wffn-hide-and-show-ty-download-block
Last active April 23, 2025 11:21
wffn hide and show ty download block
//add class for hide download block 'wffn_hide_download_block'
//add class for show only download block 'wffn_show_only_download_block' '
add_action( 'wp_head', function () {
global $post;
if ( empty( $post ) || ! $post instanceof WP_Post || 'wffn_ty' !== $post->post_type ) {
return;
}
echo '<style>
@xlplugins
xlplugins / 2nd Radio button selected on page load
Created April 21, 2025 08:11
2nd Radio button selected on page load
add_filter( 'woocommerce_available_payment_gateways', 'set_default_payment_gateway' );
function set_default_payment_gateway( $available_gateways ) {
// Ensure there are available payment gateways
if ( ! is_admin() && isset( $available_gateways ) && count( $available_gateways ) > 1 ) {
// Get the keys of available gateways
$gateway_keys = array_keys( $available_gateways );
// Set the second gateway (index 1) as default
if ( isset( $gateway_keys[1] ) ) {
@xlplugins
xlplugins / Upsell Addon for add mutiple order product to upsell with predefined discount set in upsell offer
Last active April 16, 2025 15:12
Upsell Addon for add mutiple order product to upsell with predefined discount set in upsell offer
class WFOCU_Upsell_Addon {
public function __construct() {
add_action( 'wp_footer', [ $this, 'js' ] );
add_shortcode( 'wfocu_bucket_total', [ $this, 'bucket_total' ] );
add_filter( 'wfocu_build_offer_product_before', array( $this, 'maybe_check_offer_data_for_qty_change' ), 10, 2 );
add_filter( 'wfocu_prepare_upsell_package_before', array( $this, 'maybe_check_offer_data_for_qty_change' ), 10, 2 );
add_action( 'wfocu_add_custom_html_above_accept_button', array( $this, 'schemes_template_html' ), 10, 2 );
add_filter( 'wfocu_validate_charge_request', '__return_true' );
}
@xlplugins
xlplugins / clone item as bump product at checkout
Last active April 16, 2025 07:56
clone item as bump product at checkout
/**
* WFOB_Bump_Addons - Optimized class for managing order bumps with WooCommerce cart items
*/
class WFOB_Bump_Addons {
/**
* @var array Filtered order bumps
*/
private $filtered_bumps = [];
@xlplugins
xlplugins / gist:6c76875a42641c6e990eb44ae7d81831
Last active April 14, 2025 08:32
Funnelkit Checkout Dequeue Theme Assets by using Handler
class WFACP_Dequeue_Theme_Asset_by_Slug {
/**
* Array of asset handles that should be dequeued if they exist
* These will be checked against both JS and CSS registrations
*/
private $assets_to_dequeue = [
'bootstrap',
'select2',