Total cost of products added in wishlist
-
I found this function that I put in function.php:
function tnc_wishlist_summary_cart(){ global $woocommerce; $wl_items = YITH_WCWL()->get_products(); $product_price = 0; foreach ($wl_items as $key => $item) { $the_product = wc_get_product($item['prod_id']); $product_price += $the_product->get_price(); } $output = 'Total Price: '.$product_price; return $output; } add_shortcode( 'tnc-wishlist-summary', 'tnc_wishlist_summary_cart' );
Then I call this function with a shortcode [tnc-wishlist-summary] but it seems returning always a 0 count.
What I am missing?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Total cost of products added in wishlist’ is closed to new replies.