Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / Upsell : redirect to thankyou page and programmatically end the upsell funnel once the specific time is reached.
Last active July 23, 2025 15:30
Upsell : redirect to thankyou page and programmatically end the upsell funnel once the specific time is reached.
add_action( 'wfocu_footer_before_print_scripts', 'custom_redirect_after_dynamic_time_in_minutes' );
function custom_redirect_after_dynamic_time_in_minutes() {
// Fetch the offer expiry URL using the custom function
$expiry_url = WFOCU_Core()->wc_api->get_api_url( 'end_funnel', array( 'log_event' => 'no' ) );
// Set the dynamic redirect time in minutes (e.g., 30 minutes or any value you want)
$time_in_minutes = 30; // Change this value to set different minutes for redirection
$redirect_time_in_milliseconds = $time_in_minutes * 60 * 1000; // Convert minutes to milliseconds
@xlplugins
xlplugins / gist:9e4e3cde9370a88d2f34296c61599171
Last active July 23, 2025 09:59
Funnelkit Cart: Re Run Get Slide Cart Ajax
class fkcart_re_run_get_slide_cart_ajax {
public function __construct() {
add_filter( 'fkcart_re_run_get_slide_cart_ajax', '__return_true', 9999 );
}
}
@xlplugins
xlplugins / gist:6d3dcc0d800da41eae911e383c17e795
Created July 22, 2025 06:57
Checkout: Avada Fusion builder compatability with funnelkit gutenburg 22 july 2025
class WFACP_Avada_Builder_Override_content {
public $instance=null;
public function __construct() {
add_action( 'wfacp_checkout_page_found', [ $this, 'remove_action' ], 9 );
add_action( 'avada_render_header', [ $this, 're_attach_hook' ], 9 );
}
@xlplugins
xlplugins / upsell_product_setup_hook.php
Created July 18, 2025 15:20
upsell_product_setup_hook.php
/**
* Hook: wfocu_offer_setup_completed
*
* Fires after the offer setup process is completed in FunnelKit One Click Upsells.
*
* This hook allows you to access and manipulate offer data, such as products, after the offer has been fully set up.
* You can use this hook to retrieve the product data for the current offer as shown below:
*
* Example:
* add_action( 'wfocu_offer_setup_completed', function() {
@xlplugins
xlplugins / gist:01205f759262ac28fb798ff27af4cb6d
Created July 18, 2025 10:34
Funnelkit Checkout: Display Custom Fields of checkout will be display under the tab my profile on my account page
class WFACP_Custom_field_On_Myaccount {
public $wfacp_id = 100; // Add your checkout page ID here
public $display_custom_fields = ['age', 'sport1', 'sport2', 'sport3', 'sport4']; // Add your custom field IDs here
// Add custom labels for your fields
public $field_labels = [
'age' => 'Age Range',
'sport1' => 'Primary Sport',
'sport2' => 'Secondary Sport',
@xlplugins
xlplugins / gist:80c3420f7933a1316862298c50453206
Created July 18, 2025 05:59
Funnelkit Checkout: Display Shipping Option on the page load
add_filter( 'wfacp_show_shipping_options', '__return_true' );
@xlplugins
xlplugins / display state field when not available in checkout page
Last active July 23, 2025 12:31
display state field when not available in checkout page
class WC_Hidden_State_Field_Handler {
public function __construct() {
add_action( 'wfacp_before_checkout_form_fields', [ $this, 'render_hidden_fields_on_page_load' ], 5 );
add_filter( 'woocommerce_checkout_fields', [ $this, 'inject_hidden_fields_on_ajax' ] );
add_action( 'woocommerce_checkout_process', [ $this, 'set_default_values_if_missing' ] );
}
/**
* Output hidden state fields manually during initial page load (non-AJAX).
@xlplugins
xlplugins / gist:85e19199860c10bf27f62dabc739ad32
Created July 17, 2025 08:37
Funnelkit Checkout: Enable State Field force fullfuly
add_filter( 'wfacp_form_section', function( $section ) {
$field_ids = wp_list_pluck( $section['fields'], 'id' );
$field_pairs = [
'billing_country' => 'billing_state',
'shipping_country' => 'shipping_state',
];
foreach ( $field_pairs as $country_id => $state_id ) {
if ( in_array( $country_id, $field_ids ) && ! in_array( $state_id, $field_ids ) ) {
// Find country field data and its position
foreach ( $section['fields'] as $index => $field ) {
@xlplugins
xlplugins / Funnelkit Cart: Display Total Row after order summary
Last active July 17, 2025 07:26
Funnelkit Cart: Display Total Row after order summary
class FKCART_Order_Total_Row{
public function __construct() {
add_action('fkcart_after_order_summary',[$this,'order_total_row']);
}
public function order_total_row($front) {
$total_amount="";
if ( ! is_null( WC()->session ) && ! is_null( WC()->cart ) ) {
$total_amount = WC()->cart->get_total();
@xlplugins
xlplugins / show conditional field when Shipping country is....
Created July 16, 2025 06:44
show conditional field when Shipping country is....
class Temp_WFACP_Conditional_field {
private $conditional_field = [];
public function __construct() {
$this->conditional_field = [
'shipping_country' => [
[
'value' => 'IE',
'fields' => [ 'custom_text' ],
'enable' => true,