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( 'template_redirect', 'wc_custom_redirect_after_purchase' ); | |
function wc_custom_redirect_after_purchase() { | |
global $wp; | |
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { | |
$order_id = absint( $wp->query_vars['order-received'] ); | |
wp_redirect( get_permalink( {PAGE_ID} ) . '?order=' . $order_id ); | |
exit; | |
} | |
} |
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
$product_tags = wp_get_post_terms( $product->id, 'product_tag' ); | |
if ( ! empty( $product_tags ) ) { | |
foreach( $product_tags as $tag ) { | |
if ( $tag->slug === 'tag-slug' && ! is_user_logged_in() ) { | |
return; | |
} | |
} | |
} |
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 the meta _transaction_id in the search fields. | |
* | |
* @param array $fields | |
* @return array | |
*/ | |
function wc_custom_order_filter_fields( $fields ) { | |
if ( ! in_array( '_transaction_id', $fields ) ) { | |
array_push( $fields, '_transaction_id' ); | |
} |
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 checkout fields based on the products in the cart | |
* | |
* @param array $fields | |
* @return array | |
*/ | |
function conditional_checkout_fields_products( $fields ) { | |
$cart = WC()->cart->get_cart(); | |
$has_tag = true; |
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
// Enable WP_DEBUG mode | |
define('WP_DEBUG', true); | |
// Enable Debug logging to the /wp-content/debug.log file | |
define('WP_DEBUG_LOG', true); |
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 customize_grouped_product_title( $tilte, $product ) { | |
if ( $product->get_parent() > 0 ) { | |
$title = get_the_title( $product->id ); | |
} | |
return $title; | |
} |
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 temporary_fix_product_search( $where ) { | |
global $pagenow, $wpdb, $wp; | |
if ( 'edit.php' != $pagenow || ! is_search() || ! isset( $wp->query_vars['s'] ) || 'product' != $wp->query_vars['post_type'] ) { | |
return $where; | |
} | |
$where = str_replace( "post_type = ' '", "post_type = 'product'", $where ); | |
return $where; | |
} |
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( 'wcopc_products_query_args', 'wc_opc_show_hidden_products' ); | |
function wc_opc_show_hidden_products( $args ) { | |
if ( isset( $args['meta_query'] ) ) { | |
array_push( $args['meta_query'][0]['value'], 'hidden' ); | |
} | |
return $args; | |
} |
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_product_thumbnails_columns', create_function( '', 'return 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
add_filter( 'woocommerce_ajax_variation_threshold', 'wc_ninja_ajax_threshold' ); | |
function wc_ninja_ajax_threshold() { | |
return 50; | |
} |