Woocommerce hook or action for shopping cart

-1

I have a question, for Woocommerce there is a hook or action that allows me to obtain the list that is stored in the shopping cart. Thank you so much. Thank you very much in advance

    
asked by Carlos Cespedes 06.11.2018 в 21:57
source

1 answer

0

With this code you can get the shopping cart list

<?php
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>";
    } 
?>
    
answered by 06.11.2018 / 22:37
source