WooCommerce Total # orders [closed]

You can use this following query to get the total number of orders. $order_totals = apply_filters( ‘woocommerce_reports_sales_overview_order_totals’, $wpdb->get_row( ” SELECT COUNT(posts.ID) AS total_orders FROM {$wpdb->posts} AS posts LEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID=rel.object_ID LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) LEFT JOIN {$wpdb->terms} AS … Read more

WooCommerce – How to add a custom field to only a specific email template [closed]

Best way would be to save a custom version of the theme template into your theme folder. That way you can customise that individual email and include the custom field. Can do this by copying the customer-completed-order.php from WooCommerce into a /woocommerce/templates/ folder in your theme. More info on the WooCommerce docs: Template Structure + … Read more

Disable Woocommerce checkout based on user role [closed]

Woocommerce is considered off-topic here but as a general answer, it is considered best practice to check against capabilities instead of roles In WP, this is done like that: add_action(‘init’, ‘wpse_capability_check’); // hooked on ‘init’ but depends on your actual code logic function wpse_capability_check(){ // you should check on a capability that only validated user … Read more

Woo commerce Single Product Sidebar [closed]

If you mean on your product category page: What if you remove (or comment out) the item description from your content-single-product.php, or use CSS – display:none; and place the code in your sidebar.php? Or whatever sidebar template file you are using for your products? If you don’t have one set up, you can do this … Read more