Skip to content

Instantly share code, notes, and snippets.

View pramodjodhani's full-sized avatar
🏠
Working from home

Pramod Jodhani pramodjodhani

🏠
Working from home
  • 10:26 (UTC +05:30)
View GitHub Profile
<?php
use StellarPay\Core\ValueObjects\WebhookEventType;
use StellarPay\Core\Webhooks\EventProcessor;
use StellarPay\Core\Webhooks\EventResponse;
use StellarPay\PaymentGateways\Stripe\Webhook\WebhookRegisterer;
use function StellarPay\Core\container;
@pramodjodhani
pramodjodhani / function.php
Created May 26, 2025 11:13
Flux checkout - custom validatio
add_filter('woocommerce_checkout_fields', 'add_custom_checkout_field');
function add_custom_checkout_field($fields) {
$fields['billing']['billing_custom_field'] = array(
'type' => 'text',
'label' => __('BTW-nummer'),
'required' => false, // has to be false, otherwise it's always checked dispite of country selected!
'class' => array('form-row-wide', 'tax-number-class'),
'label_class' => array('tax-number-label'),
'clear' => true,
);
@pramodjodhani
pramodjodhani / functions.php
Created May 7, 2025 13:03
Flux checkout - move company field to billing step.
/**
* Flux checkout - move company field to billing step.
*/
add_filter( 'flux_checkout_details_fields', function( $fields ) {
foreach ( $fields as $key => $field ) {
if ( $field === 'billing_company' ) {
unset( $fields[ $key ] );
}
}
@pramodjodhani
pramodjodhani / functions.php
Created May 1, 2025 07:32
Iconic Quickview - Translate text.
/**
* Iconic Quickview - Translate text.
*/
function iconic_qv_wpml_translate_text() {
global $jckqv;
if ( empty( $jckqv ) ) {
return;
}
@pramodjodhani
pramodjodhani / functions.php
Created April 3, 2025 10:15
Flux checkout: disable T&C link accordion.
<?php
/**
* Flux checkout: disable T&C link accordion.
*/
function iconic_flux_disable_tnc_link_accordion() {
?>
<script>
jQuery(document).ready(function($) {
jQuery('.woocommerce-terms-and-conditions-link').removeClass('woocommerce-terms-and-conditions-link');
});
@pramodjodhani
pramodjodhani / functions.php
Created April 3, 2025 06:04
Iconic WDS - Modify the max dates setting for a specific product.
<?php
/**
* Iconic WDS - Modify the max dates setting for a specific product.
*/
iconic_wds_modify_wds_max_dates_setting();
add_action('wp_loaded', 'iconic_wds_modify_wds_max_dates_setting', 11);
function iconic_wds_modify_wds_max_dates_setting() {
global $iconic_wds;
if ( ! isset( $iconic_wds ) ) {
@pramodjodhani
pramodjodhani / functions.php
Created March 26, 2025 03:24
Iconic WDS - Update cut off days setting conditionally
<?php
/**
* Iconic WDS - Change next day cutoff for fridays.
*/
function iconic_change_next_day_cutoff() {
global $iconic_wds;
$day = '5'; // Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7
// set cut off to 14:00 for fridays.
@pramodjodhani
pramodjodhani / functions.php
Created March 26, 2025 03:04
Iconic WDS - Disable ASAP timeslot for other than today's date
<?php
// Iconic WDS - Disable ASAP timeslot for other than today's date
function iconic_wds_filter_out_asap_timeslot( $slots, $ymd ) {
$date_ymd = filter_input( INPUT_POST, 'date', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
if ( $date_ymd !== wp_date( 'Ymd' ) ) {
$slots = array_filter( $slots, function( $slot ) {
return empty( $slot['asap'] );
} );
@pramodjodhani
pramodjodhani / functions.php
Created January 30, 2025 10:04
Flux checkout - Reverse order of street number and address fields.
<?php
/**
* Flux checkout - Reverse order of street number and address fields.
*
* @param array $fields The checkout fields.
*
* @return array
*/
function flux_reverse_order_of_street_number_address_fields( $fields ) {
$fields['billing']['billing_street_number']['priority'] = 60;
@pramodjodhani
pramodjodhani / functions.php
Created January 30, 2025 08:58
Flux checkout - change/update button texts
<?php
/**
* Flux checkout - Update button text.
*
* @return void
*/
add_action( 'wp_footer', function() {
if ( ! is_checkout() ) {
return;
}