How to hook out all products from the WooCommerce basket?

1 answer 1

global $woocommerce; $items = $woocommerce->cart->get_cart(); foreach($items as $item => $values) { $_product = wc_get_product( $values['data']->get_id()); echo "<b>".$_product->get_title().'</b> <br> Quantity: '.$values['quantity'].'<br>'; $price = get_post_meta($values['product_id'] , '_price', true); echo " Price: ".$price."<br>"; } 
  • Copied the answer from the link in my comments?))) - KAGG Design
  • Well, you did not do it) not everyone understands English. And thank you. Really helped! - Victor Vasiliev
  • And why duplicate, if you already had such a question? There is enough comment with a link - KAGG Design
  • How why, what would Russian users use. - Victor Vasiliev
  • For this there are associations, I created in the second comment - KAGG Design