1. Display The Product Price In A Wp_Query Loop In Woocommerce
<?php $price = get_post_meta( get_the_ID(), '_price', true ); ?> <?php echo wc_price( $price ); ?> //REGULAR PRICE <?php $price = get_post_meta( get_the_ID(), '_regular_price', true ); ?> <?php echo wc_price( $price ); ?> //SALE PRICE <?php $price = get_post_meta( get_the_ID(), '_sale_price', true ); ?> <?php echo wc_price( $price ); ?>
2. Display How Many Products On Cart
$cartdata = WC()->cart->cart_contents_count; echo $cartdata;
3. Woocommerce My Accoutn/Dashboard Link
<?php echo esc_url( trailingslashit( wc_get_account_endpoint_url( '' ) ) ); ?> //another way <?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>
4. Woocommerce after checkout page
add_action( 'woocommerce_review_order_after_payment', 'add_content_on_checkout' ); function add_content_on_checkout() { echo "<img src='safe_checkout.png' >"; //add the URL of the image }