This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adjust Date Column Output | |
function wc_csv_export_format_data( $order_data ) { | |
for( $i = 0; $i < count( $order_data ); $i++ ) { | |
if ( isset( $order_data[ $i ]['order_date'] ) ) { | |
$order_data[ $i ]['order_date'] = date_i18n( 'd/m/Y', strtotime( $order_data[ $i ]['order_date'] ) ); | |
} | |
} | |
return $order_data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 ); | |
function is_product_eligible( $eligible, $product, $discounter_name, $discounter_object ) { | |
remove_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 ); | |
if ( $product->is_on_sale() ) { | |
$eligible = false; | |
} | |
add_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wc_edit_bookings_form_fields_order( $fields ) { | |
$duration = $fields['wc_bookings_field_duration']; | |
$persons = $fields['wc_bookings_field_persons']; | |
$resource = $fields['wc_bookings_field_resource']; | |
$date = $fields['wc_bookings_field_start_date']; | |
$new_fields = array( | |
'wc_bookings_field_start_date' => $date, | |
'wc_bookings_field_resource' => $resource, | |
'wc_bookings_field_duration' => $duration, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wc_enqueue_js( " | |
jQuery( '.add_to_cart_inline .qty' ).on( 'change', function() { | |
var qty = jQuery( this ), | |
atc = jQuery( this ).next( '.add_to_cart_button' ); | |
atc.attr( 'data-quantity', qty.val() ); | |
}); | |
" ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( ! is_shop() && ! is_product_taxonomy() ) { | |
$quantity_field = woocommerce_quantity_input( array( | |
'input_name' => 'product_id', | |
'input_value' => ! empty( $product->cart_item['quantity'] ) ? $product->cart_item['quantity'] : 0, | |
'max_value' => $product->backorders_allowed() ? '' : $product->get_stock_quantity(), | |
'min_value' => 0, | |
), $product, false ); | |
$quantity_field = str_replace( array( '<div class="quantity">', "</div>" ), '', $quantity_field ); | |
echo str_replace( '<input ', '<input style="max-width: 70px" ', $quantity_field ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Hides the Ninja Forms add-ons' prices in the cart and checkout pages | |
* | |
* @param string $text | |
* @return string | |
*/ | |
function wc_nf_hide_price( $text ) { | |
$text = strip_tags( $text ); // Strip HTML tags <span class="amount"></span> | |
$pattern = "/\s\((\D{0,2}\d{0,3};)\s?\d+([\.,]\d+)?\s?[\D+]?\)$/"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'manage_wc_booking_posts_custom_column', 'wc_custom_bookings_columns', 3 ); | |
function wc_custom_bookings_columns( $column ) { | |
global $post, $booking; | |
if ( empty( $booking ) || $booking->id != $post->ID ) { | |
$booking = get_wc_booking( $post->ID ); | |
} | |
switch ( $column ) { | |
case 'customer': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'manage_wc_booking_posts_custom_column', 'wc_custom_bookings_columns', 3 ); | |
function wc_custom_bookings_columns( $column ) { | |
global $post, $booking; | |
if ( empty( $booking ) || $booking->id != $post->ID ) { | |
$booking = get_wc_booking( $post->ID ); | |
} | |
switch ( $column ) { | |
case 'customer': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_single_product_summary', 'wc_custom_show_attributes_outside_tabs', 35 ); | |
function wc_custom_show_attributes_outside_tabs() { | |
global $product; | |
$product->list_attributes(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form role="search" method="get" class="woocommerce-product-search" action="<?php echo esc_url( home_url( '/' ) ); ?>"> | |
<label class="screen-reader-text" for="s"><?php _e( 'Search for:', 'woocommerce' ); ?></label> | |
<input type="search" class="search-field" placeholder="<?php echo esc_attr_x( 'Search Products…', 'placeholder', 'woocommerce' ); ?>" value="<?php echo get_search_query(); ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label', 'woocommerce' ); ?>" /> | |
<input type="submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'woocommerce' ); ?>" /> | |
<input type="hidden" name="post_type" value="product" /> | |
</form> |