Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / gist:9ea8602db80e2754d1b9cc5efaed493a
Created April 30, 2024 08:50
Funnnelkit Checkout: Display the custom field of billing and shipping on the thank you page
class WFACP_Display_Billing_Shipping_Field_On_Thanku_Page {
public function __construct() {
/*
* Need to update billing format address
*
*/
add_filter( 'woocommerce_order_get_formatted_billing_address', [ $this, 'wc_order_get_formatted_billing_address' ], 10, 3 );
/*
* Need to update Shipping format address
@xlplugins
xlplugins / gist:2249889c5cedfe0376f572fb95e007d2
Created April 26, 2024 11:47
Funnelkit Cart: Compatibility added with WooCommerce Mix and Match Products by Kathy Darling
class FKCART_Woo_Mix_And_Match_Products {
private $cart = [];
private $print_html=false;
public $button_html='';
public function __construct() {
add_action('fkcart_after_item_meta',[$this,'action'],999,2);
@xlplugins
xlplugins / gist:3ec21e4a2ac290a486812a83fb74e352
Created April 26, 2024 11:36
Funnelkit Cart: Add or remove class when funnelkit cart open or closed
add_action('wp_footer',function (){
?>
<script>
window.addEventListener('load', function () {
jQuery(document.body).on('fkcart_cart_open',function(){
if(jQuery('body').hasClass('mm-wrapper--position-left')){
jQuery('body').removeClass('mm-wrapper--position-left')
}
$environment_funnel_id = WFOCU_Core()->rules->get_environment_var( 'funnel_id' );
$order_id = WFOCU_Core()->rules->get_environment_var( 'order' );
WFOCU_Core()->log->log( 'Order #' . $order_id . ' match rule details for skip funnel ' . print_r( array( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
'funnel_id' => WFOCU_Core()->data->get_funnel_id(),
'match' => ( $match ) ? 'true' : 'false',
'environment' => $environment,
'environment_funnel_id' => $environment_funnel_id
), true ) . ' rule data ' . print_r( $rule, true ) );
@xlplugins
xlplugins / Conditional fields using Radio buttonsa
Last active May 3, 2024 10:20
Conditional fields using Radio buttonsa
class WFACP_Conditional_field_tmp {
private $conditional_field = [];
public function __construct() {
/* Conditional fields */
$this->conditional_field = [
'payment_options_purchase' => [
@xlplugins
xlplugins / open side cart on menu click
Created April 25, 2024 11:24
open side cart on menu click
add_action( 'wp_footer', function () {
?>
<script>
(function ($) {
try {
$(document).on('click', '.elementor-menu-cart__toggle_button', function (e) {
e.preventDefault();
$('.elementor-menu-cart__main').hide()
$('body').trigger('fkcart_update_side_cart', [true]);
});
@xlplugins
xlplugins / [Funnelkit Checkout] Log Save the Checkout data in log when payment done by authorized.net Credit card
Last active April 24, 2024 14:45
[Funnelkit Checkout] Log Save the Checkout data in log when payment done by authorized.net Credit card
add_action( 'woocommerce_checkout_order_processed', function ($order_id) {
if ( isset( $_POST['payment_method'] ) && 'authorize_net_cim_credit_card' == $_POST['payment_method'] ) {
$log = wc_get_logger();
if ( is_null( $log ) ) {
return;
}
$log->info( 'Authorized net Payment Data order id -'.$order_id.' - ' . print_r( $_POST, true ), array( 'source' => 'funnelkit_authorized_log_test' ) );
}
} );
@xlplugins
xlplugins / add stripe support for wp swing subscriptions
Created April 24, 2024 11:59
add stripe support for wp swing subscriptions
add_filter( 'wps_sfw_supported_payment_gateway_for_woocommerce', function ( $stripe ) {
$stripe[] = 'fkwcs_stripe';
return $stripe;
} );
@xlplugins
xlplugins / open cart forcefully after booking
Created April 24, 2024 11:17
open cart forcefully after booking
add_action( 'wp_footer', function () {
?>
<script>
window.addEventListener('load', function () {
(function ($) {
try {
$(document).on('em_booking_success', function () {
console.log('fffff');
$('body').trigger('fkcart_update_side_cart', [true]);
});
@xlplugins
xlplugins / alter product attributes
Created April 24, 2024 10:57
alter product attributes
add_filter( 'wfacp_product_attributes', function ( $attributes ,$product_obj, $product_id) {
if($product_id!==252753){
return $attributes;
}
if ( isset( $attributes['attribute_razmer'] ) ) {
$attributes['attribute_%d1%80%d0%b0%d0%b7%d0%bc%d0%b5%d1%80'] = $attributes['attribute_razmer'];
unset( $attributes['attribute_razmer'] );