Skip to content

Instantly share code, notes, and snippets.

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

Pramod Jodhani pramodjodhani

🏠
Working from home
  • 11:01 (UTC +05:30)
View GitHub Profile
@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;
}
@pramodjodhani
pramodjodhani / functions.php
Last active October 10, 2025 07:15
Iconic LV (linked variation) show out of stock products
<?php
// Iconic Linked variation: Custom snippet to mark products as in stock if they're not currently in stock
add_action( 'woocommerce_single_product_summary', 'iconic_lv_add_force_instock_filter', 24 );
function iconic_lv_add_force_instock_filter() {
add_filter( 'woocommerce_product_get_stock_status', 'iconic_lv_force_product_instock_filter', 10, 2 );
}
function iconic_lv_force_product_instock_filter( $stock_status, $product ) {
// Force the product to be in stock regardless of current status
const tasks = [
{id: 1, fav: false},
{id: 2, fav: true},
{id: 3, fav: true},
{id: 4, fav: false},
];
tasks.reduce((p,c) => {
return c.fav ? p++ : p;
}, 0);
@pramodjodhani
pramodjodhani / function.php
Last active September 18, 2025 07:10
WDS - disable certain timeslot for specific products
<?php
/**
* Iconic WDS: Disable timeslots for products in cart.
*/
function iconic_wds_disable_timeslots_for_products( $timeslots ) {
// These timeslots will be disabled for the given product IDs.
// How to get the timeslot ID: https://www.loom.com/share/96bd5674116e416e933eb932742adf7b
// Todo - update this map with the actual timeslots and products.
$disable_timeslots_product_map = array(
// Example: timeslot_id => [product_id1, product_id2, ...]
@pramodjodhani
pramodjodhani / wds.php
Created September 3, 2025 06:16
WDS - Disable Monday (weekday) for given product in cart
<?php
/**
* Modify allowed days based on cart items.
*
* @param array $allowed_days
* @param bool $minmax
* * @return mixed
*/
function iconic_wds_modify_allowed_days( $allowed_days, $minmax ) {
if ( $minmax ) {
<?php
/**
* Check cart for given product id product.
*
* @param array $categories Categories.
*
* @return bool
*/
function iconic_check_for_cart_item_in_cart( $product_ids = array() ) {
if ( empty( $product_ids ) || empty( WC()->cart ) ) {
@pramodjodhani
pramodjodhani / functions.php
Created July 28, 2025 06:29
Flux checkout - Move position of shipping container to below the Shipping Adress.
<?php
/**
* Flux checkout: Move position of shipping container to below the Shipping Adress.
*/
add_action( 'woocommerce_after_order_notes', function() {
?>
<div class="flux-shipping-container--desktop"></div>
<?php
} );
@pramodjodhani
pramodjodhani / gf-mcg-php-symbol.php
Last active July 24, 2025 13:22
Gravity Forms: Modify Philippine Peso currency to display ₱ symbol instead of PHP text.
<?php
/**
* Modify Philippine Peso currency to display ₱ symbol instead of PHP text.
*
* @param array $currencies The current currencies registered in Gravity Forms.
* @return array List of currencies with modified PHP currency.
*/
function modify_php_currency_symbol( $currencies ) {
$currencies['PHP'] = array(
'name' => 'Philippine Peso',
@pramodjodhani
pramodjodhani / mcg-add-aed-currency-to-gf.php
Created July 23, 2025 17:20
Add UAE Dirham (AED) currency to Gravity Forms.
<?php
/**
* Add UAE Dirham (AED) currency to Gravity Forms.
*
* @param array $currencies The current currencies registered in Gravity Forms.
* @return array List of supported currencies with AED added.
*/
function add_aed_currency_to_gf( $currencies ) {
$currencies['AED'] = array(
'name' => 'United Arab Emirates Dirham',
@pramodjodhani
pramodjodhani / add-custom-field.php
Created July 11, 2025 13:37
Flu checkout - add custom field
<?php
/**
* Flux checkout - add custom fields.
*
* @param array $fields Checkout Fields.
*
* @return array.
*/
function flux_add_custom_field( $fields ) {
$fields['billing']['billing_birthday'] = array(