Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@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 17, 2025 10:12
display state field when not available in checkout page
class Custom_State_Field_Handler {
public function __construct() {
add_filter( 'wfacp_form_section', [ $this, 'inject_state_into_form_section' ], 10 );
add_filter( 'wfacp_checkout_fields', [ $this, 'inject_state_into_checkout_fields' ], 10 );
}
/**
* Injects state field into form section after country field if missing.
*/
@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,
@xlplugins
xlplugins / WSForm use as Optin form step
Last active July 15, 2025 09:58
WSForm use as Optin form step
add_action('wsf_submit_post_complete', 'wffn_save_wsform_data_in_optin', 10, 1);
/**
* Handles WS Form submission and maps form fields to FunnelKit optin fields dynamically.
*
* This function hooks into the 'wsf_submit_post_complete' action provided by WS Form. It dynamically maps
* WS Form fields to logical optin fields (first name, last name, email, phone) by inspecting the form's
* structure and matching on field type and label. This approach is robust to field reordering and renaming.
*
@xlplugins
xlplugins / gist:7f6dee957d0f4daf379cfa7d83cae73b
Created July 15, 2025 07:10
Funnelkit Checkout: Conflict with WooCommerce Fees and Discounts and PayPal for WooCommerce
class WCFAD_Dynamic_Pricing {
public function __construct() {
add_action( 'wfacp_before_process_checkout_template_loader', [ $this, 'remove_actions' ] );
add_action( 'wfacp_after_checkout_page_found', [ $this, 'remove_actions' ] );
}
public function remove_actions() {
remove_action( 'woocommerce_before_calculate_totals', 'wcfad_before_calculate_totals', 2, 1 );
add_action( 'woocommerce_before_calculate_totals',[$this, 'wcfad_before_calculate_totals'],3 );
@xlplugins
xlplugins / gist:f94ddfcf0c2ec1ebcffff68352a3b75d
Created July 14, 2025 11:40
Funnelkit Checkout: drile theme Css issue
.woocommerce > form.checkout #billing_address_2_field label.screen-reader-text, .woocommerce > form.checkout #shipping_address_2_field label.screen-reader-text {
position: absolute !important;
clip-path: margin-box;
}
body #wfacp-sec-wrapper span.woocommerce-input-wrapper {
display: block; width: 100%;
}
body .wfacp_main_form.woocommerce #wfacp_checkout_form #shipping_country_field label.wfacp-form-control-label,
body .wfacp_main_form.woocommerce #wfacp_checkout_form #billing_country_field label.wfacp-form-control-label,