woocommerce search by sku and title ajax

Pls Try this code if(is_numeric($search_keyword)){ $args = array( ‘posts_per_page’ => 3, ‘post_type’ => ‘product’, ‘meta_query’ => array( array( ‘key’ => ‘_sku’, ‘value’ => $search_keyword, ‘compare’ => ‘LIKE’ ) ) ); } else if(is_string($search_keyword)){ $args = array( ‘s’ => $search_keyword, ‘post_type’ => ‘product’, ‘post_status’ => ‘publish’, ‘ignore_sticky_posts’ => 1, ‘posts_per_page’ => 3, ‘orderby’ => $ordering_args[‘orderby’], ‘order’ … Read more

How do I run code every 24 hours?

To run something every 24 hours, you can use the WP Cron system. However, keep in mind: wp-cron is ran/checked after every page load. If nobody visits your site for 2 days no cron jobs can run, it needs visitors to get an opportunity to run Because it needs visitors to the site for the … Read more

Woocommerce – get_items() returns empty array

The solution that was provided here did not work for me. It seems that the order items are assigned to the order after the woocommerce_new_order hook is triggered. I only managed to sort my issues after I changed the hook to woocommerce_checkout_order_processed as per below: add_action( ‘woocommerce_checkout_order_processed’, ‘get_order_items_on_checkout’, 50, 3 ); function get_order_items_on_checkout($order_id, $posted_data, $order){ … Read more

How to reverse/swap the order of “Sales price” and “Regular prcie” in woocommerce?

You’re going to want to use hooks and filters to change that. I would look at the woocommerce_get_price_html and/or woocommerce_variable_price_html filters. EDIT: here is the core WC code you need to alter: /** * Format a sale price for display. * * @since 3.0.0 * @param string $regular_price Regular price. * @param string $sale_price Sale … Read more

How to access deleted term inside delete_product_cat action

You get 500 error, because you’ve added your filter incorrectly… It takes 4 params, but you register it as it was using only one. add_action(‘delete_product_cat’, ‘sync_cat_delete’, 10, 1); // 10 is priority, 1 is number of params to take function sync_cat_delete($term, $tt_id, $deleted_term, $object_ids){ var_dump($deleted_term); } So if you change that 1 to 4, it … Read more

How remove trashed WooCommerce orders from wc_get_orders() result?

Use Wp_Query instead it will give you the option to get data with status. $args = array( ‘post_type’ => ‘shop_order’, ‘posts_per_page’ => ‘-1’, ‘post_status’ => array(‘publish’, ‘pending’, ‘draft’, ‘auto-draft’, ‘future’,’private’, ‘inherit’, ‘trash’) ); $my_query = new WP_Query($args); $orders = $my_query->posts; echo “<pre>”; print_r($orders); echo “</pre>”; it will display All of your order. hope this will … Read more

CSS change in woo commerce Place Order Text [closed]

I will try to answer your question. since you know how the text can be changed – let me take it for CSS. View in the browser – The browser is rendering the button like this → <button type=”submit” class=”button alt” name=”woocommerce_checkout_place_order” id=”place_order” value=”Confirm order” data-value=”Confirm order”>Confirm order</button> Now create a folder by the name … Read more