Here I am sharing you the code to see how it works. The shortcode will be [strong_overstock_products]
function strong_overstock_products_output(){
$args = array(
'post_type' => 'product',
'product_cat' => 'overstock'
);
$loop = new WP_Query( $args );
?>
<ul class="txt">
<?php
while ( $loop->have_posts() ) : $loop->the_post();
global $product;
$sku = get_post_meta( get_the_ID(), '_sku', true );
echo '<li class="wc-taxonomy-child">' ;
echo '<br /><a href="'.get_permalink().'">' . woocommerce_get_product_thumbnail().'<div class="taxc-product--overlay">
<div>
VIEW PRODUCT </div>
</div>'.' </a>';
echo "<div class='sku'>SKU : ".$sku."</div>";
echo ' <a href="'.get_permalink().'">' .get_the_title().'</a>';
$pricer = get_post_meta( get_the_ID(), '_regular_price', true );
$prices = get_post_meta( get_the_ID(), '_sale_price', true );
if ( $product->is_on_sale()) {
echo '<p class="taxc-product--price">
<del aria-hidden="true"><span class="woocommerce-Price-amount amount"><bdi> ' .$pricer.'</bdi></span></del> <ins><span class="woocommerce-Price-amount amount"><bdi>' .$prices . ' </bdi></span></ins> </p>';
} else {
echo '<p class="taxc-product--price">
<ins><span class="woocommerce-Price-amount amount"><bdi>' .$pricer . ' </bdi></span></ins> </p>';
}
?>
<?php
echo '</li>' ;
endwhile;
?>
</ul>
<?php
wp_reset_query();
}
add_shortcode('strong_overstock_products', 'strong_overstock_products_output');