Display pledged amount per Campaign
-
Hello everybody,
I would like to display the amount a user has pledged for a campaign. Ideally, I would like to implement it into a widget where it would show for each logged-in user how much they pledged per campaign.I have found a total spent widget for woocommerce that looks like this:
add_shortcode('user_total_spent', 'get_user_total_spent'); function get_user_total_spent( $atts ) { extract( shortcode_atts( array( 'user_id' => get_current_user_id(), ), $atts, 'user_total_spent' ) ); if( $user_id > 0 ) { $customer = new WC_Customer( $user_id ); // Get WC_Customer Object $total_spent = $customer->get_total_spent(); // Get total spent amount return wc_price( $total_spent ); // return formatted total spent amount } } // USAGE: [user_total_spent] or [user_total_spent user_id="118"]
I couldn’t figure out how to change it to the total spent per product id.
Could anyone give me a hand or recommend an easier way?
Thank you in advance,
Best Regards,
Denia
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Display pledged amount per Campaign’ is closed to new replies.