WooCommerce: Merge 3 custom shortcodes in one
I have three separate woocommerce snippets where each one have one function. I'm trying to combine them together in one script but can't seems to return more than one value. function display_woocommerce_order_count2( $atts, $content = null ) { $args = shortcode_atts( array( 'status' => 'completed', ), $atts ); $statuses = array_map( 'trim', explode( ',', $args['status'] ) ); $order_count = 0; foreach ( $statuses as $status ) { // if we didn't get a wc- prefix, add one if ( 0 !== strpos( $status, 'wc-' ) ) { $status = 'wc-' . $status; } $order_count += wp_count_posts( 'shop_order' )->$status; }