Created
March 9, 2023 06:16
-
-
Save ibrahim-kardi/77e6b8d14b12150681bf7ff265710859 to your computer and use it in GitHub Desktop.
add to cart woocommerce product list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment