Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / Conditional fields using Radio buttonsa
Created April 26, 2024 05:36
Conditional fields using Radio buttonsa
class WFACP_Conditional_field_tmp {
private $conditional_field = [];
public function __construct() {
/* Conditional fields */
$this->conditional_field = [
'select_user_type' => [
@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'] );
@xlplugins
xlplugins / Funnelkit Checkout: Dequeue Theme Assets on the checkout page
Created April 24, 2024 07:17
Funnelkit Checkout: Dequeue Theme Assets on the checkout page
add_action( 'wfacp_after_checkout_page_found', function () {
if ( function_exists( 'consulting_load_theme_scripts_and_styles' ) ) {
remove_action( 'wp_enqueue_scripts', 'consulting_load_theme_scripts_and_styles' );
}
} );
@xlplugins
xlplugins / update side cart at page load
Last active April 23, 2024 13:05
update side cart at page load #side cart
// Paste your JS code here, don't include script tags<script>
window.addEventListener('load', function () {
(function ($) {
$('body .cart-trigger').click(function(){
$('body').trigger('fkcart_open');
$('.oxy-off-canvas').css('display','none')
});
setTimeout(($) => {
@xlplugins
xlplugins / gist:e94f9c9b45eef7f27ab97b4af6f42b33
Last active April 23, 2024 11:53
Funnelkit Checkout: Compatability Added with InPost PL by iLabs.dev v.1.3.8
class WFACP_Compatibility_With_Inpost_For_WC {
private $instance = null;
public function __construct() {
add_action('wfacp_after_template_found',function(){
add_action('woocommerce_review_order_before_shipping',function(){
if(class_exists('InspireLabs\WoocommerceInpost\shipping\EasyPack_Shippng_Parcel_Machines')){
@xlplugins
xlplugins / Change Dropdown Values
Created April 23, 2024 11:48
Change Dropdown Values
class WFACP_Change_Dropdown_Values {
public function __construct() {
add_filter( 'wfacp_admin_order_field', [ $this, 'change_options' ], 30 );
add_filter( 'wfacp_forms_field', [ $this, 'change_options' ], 30 );
}
public function change_options( $field ) {
if ( in_array( $field['type'], [ 'select', 'dropdown' ] ) ) {
$new_options = [ '' => '' ];
foreach ( $field['options'] as $key => $option ) {