Skip to content

Instantly share code, notes, and snippets.

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

Pramod Jodhani pramodjodhani

🏠
Working from home
  • 07:45 (UTC +05:30)
View GitHub Profile
@pramodjodhani
pramodjodhani / functions.php
Created April 17, 2024 08:54
Iconic WDS - thank you page - change the position of edit timeslot.
<?php
/**
* Iconic WDS - TY page - change the position of edit timeslot.
*
* @return void
*/
function iconic_wds_change_position_of_edit_timeslot_ty_page() {
remove_action( 'woocommerce_order_details_after_order_table', array( 'Iconic_WDS_Edit_Timeslots', 'maybe_display_checkout_fields' ), 10 );
add_action( 'woocommerce_before_thankyou', array( 'Iconic_WDS_Edit_Timeslots', 'maybe_display_checkout_fields' ), 10 );
}
@pramodjodhani
pramodjodhani / functions.php
Created April 5, 2024 06:52
WooCommerce change new customer's auto generated username format.
<?php
/**
* Custom new username for new customer.
*
* @param string $username Username.
* @param string $email Email.
* @param array $new_user_args New user args.
* @param string $suffix Suffix.
*
* @return string
@pramodjodhani
pramodjodhani / function.php
Last active April 4, 2024 06:55
Flux - move the position of shipping section in classic theme
<?php
/**
* Move shiping section for classic theme.
*
* @param array $step Step data.
*
* @return void
*/
function move_shipping_section_after_shipping_address( $step ) {
if ( 'payment' === $step['slug'] ) {
@pramodjodhani
pramodjodhani / functions.php
Created April 1, 2024 05:12
Iconic WDS GCal - do not include first name and last name in the event address
<?php
/**
* Iconic WDS GCal - do not include the first and last name in the event address.
*
* @param string $location Location.
* @param array $order Order.
*
* @return string
*/
function iconic_wds_gcal_change_location( $location, $order ) {
@pramodjodhani
pramodjodhani / function.php
Created February 28, 2024 07:42
flux - payment plugin apple pay button relocate
add_action(
'wp_head',
function() {
if ( is_checkout() ) {
?>
<style>
/* Hide the other express checkout containers generated by other gateway plugins. */
.wc-stripe-banner-checkout,
.wc-ppcp-express-checkout {
display: none !important;
@pramodjodhani
pramodjodhani / functions.php
Created February 20, 2024 06:39
WDS - disable dates until 1st June when specific products are in cart
<?php // Dont add this link to functions.php
/**
* Iconic WDS - Disable all dates for specific product.
*
* @param array $available_dates Available dates.
* @param string $format Date format.
* @param bool $ignore_slots Ignore slots.
*
* @return array
*/
@pramodjodhani
pramodjodhani / functions.php
Created February 14, 2024 08:05
Flux checkout - disable address autofill by browser
/**
* Flux checkout - disable autofill.
*
* @return void
*/
function iconic_flux_disable_autofill_address() {
if ( ! is_checkout() ) {
return;
}
@pramodjodhani
pramodjodhani / gravityforms.php
Created February 6, 2024 08:55
Add a custom merge tag {custom_today_ymd}
<?php
// Create a custom merge tag for gravity forms.
add_filter( 'gform_custom_merge_tags', 'pj_add_custom_merge_tags', 10, 4 );
function pj_add_custom_merge_tags( $merge_tags, $form_id, $fields, $element_id ) {
$merge_tags[] = array( 'label' => 'Today date(Y-M-D)', 'tag' => '{custom_today_ymd}' );
return $merge_tags;
}
// Add a custom merge tag to the list of available merge tags in the form editor.
add_filter( 'gform_merge_tags', 'pj_add_custom_merge_tag', 10, 4 );
@pramodjodhani
pramodjodhani / functions.php
Created January 29, 2024 05:18
Flux checkout - hide shipping section for details and address step.
<?php // do not include this line to functions.php
/**
* Flux checkout - hide shipping section for details and address step.
*/
function flux_hide_shipping_section_for_details_address_step() {
if ( ! is_checkout() ) {
return;
}
?>
@pramodjodhani
pramodjodhani / functions.php
Created January 24, 2024 06:32
Iconic WDS - compatiblity with CartFlows.
/**
* Iconic WDS - compatiblity with CartFlows.
*/
add_action(
'wp_footer',
function() {
if ( ! is_checkout() ) {
return;
}
?>