<?php
    global $woocommerce;
    $items = $woocommerce->cart->get_cart();

$a=array();

        foreach($items as $item => $values) {
            $_product = $values['data']->post;
            //product image
            $getProductDetail = wc_get_product( $values['product_id'] );
             $getProductDetail->get_image(); // accepts 2 arguments ( size, attr )

             "<b>".$_product->post_title.'</b>  <br> Quantity: '.$values['quantity'].'<br>';
            $price = get_post_meta($values['product_id'] , '_price', true);
             "  Price: ".$price."<br>";
            /*Regular Price and Sale Price*/
             "Regular Price: ".get_post_meta($values['product_id'] , '_regular_price', true)."<br>";
             "Sale Price: ".get_post_meta($values['product_id'] , '_sale_price', true)."<br>";

$reg_sale="descount Price: ".get_post_meta($values['product_id'] , '_regular_price', true)-get_post_meta($values['product_id'] , '_sale_price', true);

$regquant=$values['quantity']*get_post_meta($values['product_id'] , '_regular_price', true);
             "Regular Price*Quantity: ".$regquant."<br>";

array_push($a,$regquant);
        }
$original_price=array_sum($a);

?>

Comments

Popular posts from this blog

Wordpress Interview Questions

PHP Interview Questions