pagination in woocommerce order history page

I have added pagination in order history page and it is working. Replace below code above loop $customer_orders1 = get_posts(apply_filters(‘woocommerce_my_account_my_orders_query’, array( ‘numberposts’ => -1, ‘meta_key’ => ‘_customer_user’, ‘meta_value’ => get_current_user_id(), ‘post_type’ => wc_get_order_types(‘view-orders’), ‘post_status’ => array_keys(wc_get_order_statuses()) ))); $total_records = count($customer_orders1); $posts_per_page = 20; $total_pages = ceil($total_records / $posts_per_page); $paged = ( get_query_var(‘page’) ) ? get_query_var(‘page’) … Read more

WP_Query | Help me create a search term with an ‘OR’ relation?

(Revised on March 25 2020 UTC) So in this revised answer, I’ll just begin with the code: Define the variables: (I intentionally included only the $args part) // define POSTed/submitted variables here like $paged, $display_count and $direction // define the offset/’direction’ stuff here // then define your $args array $args = array( ‘post_type’ => ‘product’, … Read more

How to add Woocomrce cart page shipping calculator to my country state list

Add this snippet to the functions.php file of your theme to add a new country to the WooCommerce countries list. add_filter(‘woocommerce_states’, ‘sa_woocommerce_states’); add_filter(‘woocommerce_countries_allowed_country_states’,’sa_woocommerce_state’); function SA_woocommerce_states( $states ) { $states[‘ZA’][‘EC’] = __(‘Eastern Cape’, ‘woocommerce’); return $states; }

How to remove “out of stock” variation options from size dropdown in woocommerce?

Initially. It should be said that WooCommerce is considered a plugin and therefore your question could probably be flagged as ‘Off-topic’. This (however) is such a bullshit and self-deprecating for this StackExchange, so I’ll answer it anyway. 🙂 But next time you have a WooCommerce-question, you should ask it on StackOverflow (apparantly). My first thought … Read more

Optimizing Woocommerce order items query

I’m doing something similar. I started off with an approach similar to yours, but made it slightly faster by directly using WC API Query instead of WP Query. I am still looking for a way to query the variation from all orders… //get number of orders per variation_id function getOrdersfromVariation($variation_id){ $numberOfOrders = 0; ip_write_log(“getOrdersfromVariation varid: … Read more