Can’t find a product by SKU

Add This Code In functions.php then save it. After Changes, You can see the changes in the screenshots function search_by_sku_for_admin( $search, &$query_vars ) { global $wpdb, $pagenow; if ( ‘edit.php’ != $pagenow || empty($search) ) { return $search; } $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘product’, ‘meta_query’ => array( array( ‘key’ => ‘_sku’, … Read more

Woocommerce checkout field

Try : add_filter( ‘woocommerce_checkout_fields’ , ‘custom_override_checkout_fields’ ); function custom_override_checkout_fields( $fields ) { if(is_user_logged_in()){ unset($fields[‘billing’][‘billing_email’]); } return $fields; } Source : https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/

Exclude a Woocommerce product from WP_Query

You can use “post__not_in” Parameter. add your products id in array which you want to exclude. $default = array( ‘post_type’ => ‘product’, ‘post__not_in’ => array(2024), ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘post_status’ => ‘publish’, ‘showposts’ => $numberposts ); if( $category != ” ){ $term = get_term_by( ‘slug’, $category, ‘product_cat’ ); if( $term ) : $term_name … Read more

WP_Query Taxonomy categories filtering

You can nest your tax queries. Just make sure you use OR as the first relation and AND relation on the nested tax queries. $filter_group_a = array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘slug’, ‘terms’ => $term_a, ), array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘slug’, ‘terms’ => $term_b, ), ); $filter_group_b = … Read more

WooCommerce Endpoints content

Dang it…must be blind….FOUND IT. The solution is, that since this is a custom hook, and most likely using JQuery, you place the end point action within the call. Instead of this: function mylistings_information_endpoint_content() { echo ‘THIS IS A TEST OF THE CONTENT’; } add_action( ‘woocommerce_account_information_endpoint’, ‘mylistings_information_endpoint_content’ ); It is this: function **mylistings**_information_endpoint_content() { echo … Read more

add sub subpage endpoint to woocommerce plugin my-account section

You can’t add alumni-portal/alumni-index as a separate endpoint, because this clashes with the alumni-portal endpoint. This is because rewrite endpoints will capture anything after / as their value. So alumni-portal/alumni-index is the same as alumni-portal, but the alumni-portal query var is set to alumni-index. So rather than registering both endpoints, register alumni-portal a single endpoint, … Read more

add_filter to specific WooCommerce Category

To account for variations, I’d suggest using $product->get_category_ids() and checking if your category is in there: function wcs_custom_get_availability( $availability, $_product ) { $workshops_category = get_term_by( ‘slug’, ‘workshops’, ‘product_cat’ ); $product_category_ids = $_product->get_category_ids(); if ( ! in_array( $workshops_category->term_id, $product_category_ids ) ) { return $availability; } // Change In Stock Text if ( $_product->is_in_stock() ) { $availability[‘availability’] … Read more

Call WC_Product get_price()?

Regarding the filter, you tried, not working, my hunch is that it’ not working, because it’s missing (priority and) accepted arg count parameter(s). At the moment add_filter(‘woocommerce_product_get_price’, ‘test_change’); Defaults to priority 10 and 1 parameter for your callback, but you’re using two args in function test_change($value, $prop) { return 666; } Thus you’d need to … Read more