Skip to content

Instantly share code, notes, and snippets.

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

Pramod Jodhani pramodjodhani

🏠
Working from home
  • 23:58 (UTC +05:30)
View GitHub Profile
@pramodjodhani
pramodjodhani / functions.php
Created March 9, 2026 05:55
Prevent Flux Stepper from advancing to the next step if EU VAT number is invalid.
<?php
/**
* Prevent Flux Stepper from advancing to the next step if EU VAT number is invalid.
*/
add_filter( 'flux_checkout_check_for_inline_errors', 'flux_validate_eu_vat_number', 10, 1 );
function flux_validate_eu_vat_number( $messages ) {
// Check if fields were sent in the AJAX request
if ( ! isset( $_POST['fields'] ) || ! is_array( $_POST['fields'] ) ) {
return $messages;
}
@pramodjodhani
pramodjodhani / functions.php
Last active February 26, 2026 07:34
Add Orderable time slot and date to a given order ID.
<?php
/**
* Add Orderable time slot and date to a given order ID.
*
* @param int $order_id The WooCommerce Order ID.
* @param string $date The Date (e.g., '2026-02-26').
* @param string $time The Time (e.g., '10:00 - 11:00' or '10:00').
* @param string $service_type The Service Type (e.g., 'delivery' or 'pickup'). Default 'delivery'.
* @return bool True if successful, false otherwise.
*/
@pramodjodhani
pramodjodhani / function.php
Created February 23, 2026 06:10
Restrict Orderable service dates if a specific product is in the cart.
<?php
/**
* Restrict Orderable service dates if a specific product is in the cart.
*
* @param array|bool $service_dates The currently available service dates.
* @param string $type The service type ('delivery' or 'pickup').
* @param Orderable_Location_Single $location The location instance.
* @return array|bool
*/
function orderable_restrict_service_dates( $service_dates, $type, $location ) {
@pramodjodhani
pramodjodhani / function.php
Created February 19, 2026 06:52
Iconic Product configurator - compatibility with Avada theme's swatches.
<?php
/**
* Iconic Product configurator - compatibility with Avada theme's swatches.
*/
add_action( 'wp_footer', function() {
?>
<script>
jQuery(document).ready(function($) {
jQuery('.avada-color-select').click(function() {
const siblings = jQuery(this).siblings('.avada-select-parent');
@pramodjodhani
pramodjodhani / functions.php
Created February 12, 2026 06:11
Orderable: Disable auto select date time.
/**
* Orderable Pro: Disable auto select date time.
*/
function orderable_pro_disable_auto_select_date_time() {
?>
<script>
jQuery(document).ready(function($) {
wp.hooks.addFilter('orderable_pro_timing_disable_auto_select_date_time','snippets', function() {
return true;
});
@pramodjodhani
pramodjodhani / functions.php
Created February 6, 2026 08:49
Iconic WDS - reservation table not working with Popup Box
<?php
add_filter( 'iconic_wds_force_load_reservation_calendar_assets', '__return_true' );
/**
* Trigger custom event when .ays-pb-modal becomes visible.
*/
add_action( 'wp_footer', function() {
?>
<script type="text/javascript">
(function() {
@pramodjodhani
pramodjodhani / functions.php
Created January 30, 2026 09:03
Orderable addons: shortcode to display the total price of the product with addons
<?php
/**
* Orderable addons: shortcode to display the total price of the product with addons
*/
function orderable_addons_price_total() {
global $product;
$price = $product->get_price();
return sprintf('<div class="orderable-product__actions-price">%s</div>', wc_price($price));
}
add_shortcode( 'orderable_addons_price_total', 'orderable_addons_price_total' );
@pramodjodhani
pramodjodhani / function.php
Created December 24, 2025 06:27
Iconic WDS - change Fees description to "Collection Fee" for local pickup.
<?php
/**
* Iconic WDS - change Fees description to "Collection Fee" for local pickup.
*
* @param string $label Label.
*
* @return string
*/
function iconic_wds_update_fee( $label ) {
if ( empty( $_POST['post_data'] ) ) {
@pramodjodhani
pramodjodhani / functions.php
Created November 28, 2025 10:44
Iconic WDS - Disable holidays and timeslots.
/**
* Iconic WDS - Disable holidays and timeslots.
* Can be useful when because of a user error, holidays or Timeslots have incorrect values
* breaking the site.
*
* This provides a temporary access to the settings to fix the issue.
* To be removed after the issue is fixed.
*/
add_action( 'wp_loaded', 'iconic_wds_disable_holidays_timeslots', 11 );
function iconic_wds_disable_holidays_timeslots() {
@pramodjodhani
pramodjodhani / functions.php
Created October 10, 2025 07:50
LV - Add custom buttons to Linked variation
<?php
add_filter( 'iconic_wlv_group_data', 'iconic_lv_add_custom_linked_variations', 10, 2 );
function iconic_lv_add_custom_linked_variations( $group_data, $product_id ) {
// Todo1. Add the actual linked variation ID here
$linked_variation_id = 93;
if ( $group_data['group']->post->ID !== $linked_variation_id ) {
return $group_data;
}