skip to Main Content

WooCommerce hide product without thumbnail

Is there any way to hide products that have no thumbnail, I've tried this code but doesn't work. add_action( 'woocommerce_product_query', 'custom_pre_get_posts_query' ); function custom_pre_get_posts_query( $query ) { $query->set( 'meta_query', array( array( 'key' => '_thumbnail_id', 'value' => '0', 'compare' => '>'…

VIEW QUESTION

Add a custom "Buy now" button on WooCommerce single product page which clears the cart, add a product and redirect to checkout – WordPress

I'm using this simple code to add a 'buy now' button on a single product page. add_action( 'woocommerce_after_add_to_cart_button', 'add_content_after_addtocart' ); function add_content_after_addtocart() { // get the current post/product ID $current_product_id = get_the_ID(); // get the product based on the ID…

VIEW QUESTION

WooCommerce get product type after save

Can you please tell me how can I get product type after product save? add_action( 'save_post_product', 'nd_update_group_product_attributes_func', 1001, 3 ); function nd_update_group_product_attributes_func($post_ID, $post, $update) { if($post->post_type == 'product'){ $childrens = $post->get_children(); $product_type = $post->get_type(); /* this will return simple for…

VIEW QUESTION
Back To Top
Search