This file contains 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
<?php | |
/** | |
* Snippet 1: Hide prices on all categories | |
* Created by: Tyche Softwares | |
*/ | |
function tyches_hide_prices_on_all_categories( $price, $product ) { | |
if ( is_tax() ) { | |
return ''; // Empty string = no price! | |
} |
This file contains 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
<?php | |
public function woo_empty_cart_action() { | |
global $woocommerce; | |
if ( isset( $_REQUEST[ 'emptycart' ] ) && $_REQUEST[ 'emptycart' ] == 'yes' ) { | |
$woocommerce->cart->empty_cart(); | |
} | |
} |
This file contains 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
<?php | |
/** | |
* Empties the cart and optionally the persistent cart too. | |
* | |
* @param bool $clear_persistent_cart (default: true) | |
*/ | |
public function empty_cart( $clear_persistent_cart = true ) { | |
$this->cart_contents = array(); | |
$this->reset( true ); |
This file contains 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
<?php | |
/** | |
* Return the orders count of a specific order status. | |
* | |
* @param string $status | |
* @return int | |
*/ | |
function wc_orders_count( $status ) { | |
$count = 0; |
This file contains 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
<?php | |
add_filter( 'woocommerce_include_processing_order_count_in_menu', 'exclude_processing_order_count' ); | |
function exclude_processing_order_count( $show ) { | |
$show = false; | |
return $show; | |
} |
This file contains 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
<?php | |
// Delivery date & Time in list of orders on WooCommerce Edit Order page in Admin | |
if ( get_option( 'orddd_show_column_on_orders_page_check' ) == 'on' ) { | |
add_filter( 'manage_edit-shop_order_columns', array( 'orddd_filter', 'orddd_woocommerce_order_delivery_date_column' ), 20, 1 ); | |
add_action( 'manage_shop_order_posts_custom_column', array( 'orddd_filter', 'orddd_woocommerce_custom_column_value' ), 20, 1 ); | |
add_filter( 'manage_edit-shop_order_sortable_columns', array( 'orddd_filter', 'orddd_woocommerce_custom_column_value_sort' ) ); | |
add_filter( 'request', array( 'orddd_filter', 'orddd_woocommerce_delivery_date_orderby' ) ); | |
} |
This file contains 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
<?php | |
add_action( 'manage_shop_order_posts_custom_column', 'MY_COLUMNS_VALUES_FUNCTION', 2 ); | |
function MY_COLUMNS_VALUES_FUNCTION( $column ) { | |
global $post; | |
$data = get_post_meta( $post->ID ); | |
//start editing, I was saving my fields for the orders as custom post meta | |
//if you did the same, follow this code | |
This file contains 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
<?php | |
add_filter( "manage_edit-shop_order_sortable_columns", 'MY_COLUMNS_SORT_FUNCTION' ); | |
function MY_COLUMNS_SORT_FUNCTION( $columns ) | |
{ | |
$custom = array( | |
'MY_COLUMN_ID_1' => 'MY_COLUMN_1_POST_META_ID', | |
'MY_COLUMN_ID_2' => 'MY_COLUMN_2_POST_META_ID' | |
); | |
return wp_parse_args( $custom, $columns ); |
This file contains 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
<?php | |
add_filter( 'manage_edit-shop_order_columns', 'MY_COLUMNS_FUNCTION' ); | |
function MY_COLUMNS_FUNCTION( $columns ) { | |
$new_columns = ( is_array( $columns ) ) ? $columns : array(); | |
unset( $new_columns[ 'order_actions' ] ); | |
//edit this for your column(s) | |
//all of your columns will be added before the actions column | |
$new_columns['MY_COLUMN_ID_1'] = 'MY_COLUMN_1_TITLE'; |
NewerOlder