on the title: new WC_Coupon( coupon- post_title This gives you more freedom in how you can use the. Download Filter Orders by Coupon, tutorials. You could do this for any post type created by WooCommerce, such as orders or products, as well. After a large effort on our end and the L3 support at WPEngine, they were able to trace back the performance to a looping of queries to the wp_postmeta table but were not sure why. P#L178 get_post_meta ultimately down the line trigger update_meta_cache to be called. Filter Orders by Coupon Plugin, since I already did the work for this, heres the finished plugin on GitHub which you can use to look over the code, or install it to filter your WooCommerce orders by coupon used in the order.
Weve been trying to run reports using the WooCommerce Customer/Order CSV Export plugin but have been running into timeout issuesthe glorious WordPress white screen of death. The key function well need to use here is get_posts. The SQL query to pull post meta does not include the meta_key, because WordPress is built in a way that it will attempt to instead just make a single SQL query and cache the entire result. WC_Coupon class for other methods you can use with the coupon object.
Mysql - How WooCommerce Coupons are stored in Database?
Order_item_name 'Product Name' group. Now you didnt get this data for your health, right? So in WooCommerce (as.3.x) every use of a coupon means another post meta is added to that coupon with the key _used_by. Get All Posts for a WordPress Post Type. Post_id then ta_value END) AS free_shipping, - Allow free shipping Max(case when ta_key 'expiry_date' AND. Were only including published coupons (no drafts or pending coupons and were sorting them by name. Heres a sample of what some of that data will look like if we were to dump it: Array ( 0 WP_Post Object ( ID 175 post_author 1 post_date 19:09:33 post_date_gmt 00:09:33 post_content post_title 10off post_excerpt Gives 10 percent discount on all cart contents post_status. One parameter to which Id recommend paying elektromarkt schmaus gutschein attention is post_per_page, as this will determine how many results you get. Stack Overflow, join us in building a kind, collaborative learning community via our updated. Post_id then ta_value END) AS individual_use, - Individual use only Max(case when ta_key 'exclude_sale_items' AND.