I need to be able to show the products that the logged in user has created, for this I have made this function that generates a ShortCode:
function productosUsuario() {
global $current_user, $user_login;
if ($user_login) {
$product = wc_get_product( '1149' );
$html = '<section id="my-products">
<div class="item">
<figure>'. $product->get_image() .'</figure>
<div class="info">
<span class="sku">'. $product->get_sku() .'</span>
<h2 class="name">'. $product->get_name() .'</h2>
<span class="visits">3 Visits | 1 Contact</span>
</div>
<div class="price">
<h2>us$'. $product->get_price() .'</h2>
</div>
<div class="quality">
<span class="number">85%</span>
<label>Standar Quality</label>
</div>
<div class="actions">
<ul>
<li><a href="/edit-product/?product_id='.
$product->get_id() .'">Edit Product</a></li>
<li><a href="../product/'.
$product->get_slug() .
'">View you Product</a></li>
<li>Pause</li>
<li><a href="/frequent-questions/">I need Help!</a></li>
</ul>
</div>
</div>
</section>';
echo $html;
}
}
add_shortcode( 'productosUsuario', 'productosUsuario' );
The function only shows a specific product but I need it to show the products of the user who is logged in, how do I do that filter and/or condition?