Remove Zero Money From Previews Order woocommerce

You can update new price using below method – $order_id = 123; $order = wc_get_order( $order_id ); foreach( $order->get_items() as $item_id => $item ){ $new_product_price = 30; $product_quantity = (int) $item->get_quantity(); $new_line_item_price = $new_product_price * $product_quantity; $item->set_subtotal( $new_line_item_price ); $item->set_total( $new_line_item_price ); $item->save(); // Save line item data } $order->calculate_totals();

Create a Search Form that only Searches with WooCommerce Sale Products

Yes, you can add search value in getting post query like this : $args = array( ‘post_type’ => ‘product’, ‘s’ => ‘search value’, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( // Simple products type ‘key’ => ‘_sale_price’, ‘value’ => 0, ‘compare’ => ‘>’, ‘type’ => ‘numeric’ ), array( // Variable products type ‘key’ => ‘_min_variation_sale_price’, … Read more

How can I show “sold out” instead of “out of stock” for some products with particular tags and categories [closed]

Try this add_filter( ‘woocommerce_get_availability’, ‘change_out_of_stock_text_woocommerce’, 1, 2); function change_out_of_stock_text_woocommerce( $availability, $product_to_check ) { if ( ! $product_to_check->is_in_stock() || has_term( ‘my-ex-cat-slug’, ‘product_cat’ ) || has_term( ‘my-ex-tag-slug’, ‘product_tag’ )) { $availability[‘availability’] = __(‘Sold Out’, ‘woocommerce’); } return $availability; } Change my-ex-cat-slug with your Category’s slug and my-ex-tag-slug with tag’s slug