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 / 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 ) {
@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 stripe express setting gateway description
Created April 22, 2024 13:28
change stripe express setting gateway description
add_filter('woocommerce_get_settings_checkout',function ($settings, $current_section){
if(isset($settings['section_title'])){
$settings['section_title']= [
'name' => __( 'Express Checkout', 'funnelkit-stripe-woo-payment-gateway' ),
'type' => 'title',
/* translators: HTML for the express checkout section heading */
'desc' => sprintf( __( 'Accept payment using Apple Pay, Google Pay and Browser Payment using Express Buttons.
The visibility of these payment buttons is browser dependent. Click on "Test Visibility" button to see if your browser supports these button.
Learn more %1$1sabout the requirements%2$2s to show Apple Pay, Google Pay and Browser Payment method. Test', 'funnelkit-stripe-woo-payment-gateway' ), '<a href="https://stripe.com/docs/stripe-js/elements/payment-request-button#html-js-testing" target="_blank">', '</a>' ),