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:58 (UTC +05:30)
View GitHub Profile
@pramodjodhani
pramodjodhani / functions.php
Created September 14, 2022 12:20
Flux checkout - show notice "Get 20% off when purchasing 2"
<?php
add_action( 'woocommerce_review_order_before_cart_contents', 'flux_display_display_notice_to_get_discount_with_qty', 10 );
function flux_display_display_notice_to_get_discount_with_qty() {
$current = WC()->cart->cart_contents_count;
$return_to = wc_get_page_permalink( 'shop' );
echo '<tr><td colspan="2">';
switch ( $current ) {
case '1':
$added_text = 'Get 20% off when purchasing 2!';
@pramodjodhani
pramodjodhani / functions.php
Created October 3, 2022 09:36
Fix issue with Blocksy theme
<?php
add_action(
'init',
function() {
$GLOBALS['ct_skip_checkout'] = 1;
}
);
@pramodjodhani
pramodjodhani / functions.php
Created October 14, 2022 04:50
Iconic WDS - add delivery date/time to Print Invoice & Delivery Notes for WooCommerce by Tyche Softwares
<?php
/**
* Add delivery date and time to Print Invoice & Delivery Notes for WooCommerce by Tyche Softwares.
*
* @param array $fields
* @param WC_Order $order
*
* @return array
*/
function iconic_add_invoice_fields( $fields, $order ) {
@pramodjodhani
pramodjodhani / funcitons.php
Created October 14, 2022 04:51
Iconic Delivery slots (WDS) define specific for a category
<?php
/**
* Iconic WDS - Set specific dates for a product category.
*
* @param array $dates
* @param string $format
* @param bool $ignore_slots
*
* @return array
<?php
/**
* Flux - Add street number last in the billing address.
*
* @param string $new_billing_address Billing address with street number.
* @param string $current_billing_address Billing Address without street number.
* @param string $billing_street_no Billing street number.
* @param WC_Order $order Order.
*
* @return string
<?php
/**
* Modify "Continue Shopping" button URL on the Flux Thank You page.
*
* @param string $shop_url Shop page url.
*
* @return string
*/
function flux_checkout_change_shop_page_url( $shop_url ) {
<?php
/**
* Iconic WDS - disable Fee for local pickup.
*
* @return void
*/
function iconic_wds_disable_fees_for_flatrate() {
$shipping_methods = WC()->session->get( 'chosen_shipping_methods' );
$post_data = filter_input( INPUT_POST, 'post_data' );
@pramodjodhani
pramodjodhani / wds-reservation-table-change-date-format.php
Last active November 28, 2022 10:01
Modify format of the selected date at Reservation Table.
<?php
/**
* Modify format of the selected date at Reservation Table.
* Remove st, th, etc suffix.
*
* @param array $dates Dates.
*/
function iconic_wds_modify_date_format_reservation_table( $dates, $format ) {
if ( ! wp_doing_ajax() ) {
return $dates;
<?php
/**
* Iconic WDS - dont include delivery date/timeslot to invoice generated by Overnight PDF Invoices & Packing Slips for WooCommerce.
*
* @return void
*/
function iconic_wds_exclude_item_data_pdf_invoice() {
$action = filter_input( INPUT_GET, 'action' );
if ( 'generate_wpo_wcpdf' === $action ) {
remove_filter( 'woocommerce_get_order_item_totals', array( 'Iconic_WDS_Order', 'add_to_order_details' ), 10, 3 );
<?php
/**
* Display a dropdown of non-hierarchical post types.
* For hierarchical CPTs you can use `wp_dropdown_pages`.
*
* @param string $args Arguments.
*
* @return void
*/
public function dropdown_non_hierarchical_posts( $args ) {