• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

How to Get Product Id for especific Producer

asdriel

Member
Apr 26, 2019
199
18
18
www.bantu-2rsn.com
Hello, I have this code and would like to get the product id, so I can pick up the specific products from a producer.

for the solution we are looking for, we think it is better to take a second image every time a product is published, and this image will change according to percentage figures. any help with this solution?


add_action( 'woocommerce_after_single_product_summary' , 'bbloomer_add_below_prod_gallery', 5 );

function bbloomer_add_below_prod_gallery() {
if ( has_post_thumbnail( $product->id ) ) {

echo $product->get_image_id();
}
else{
echo '<span>It's doesn't work</span>';
}


}

with this i can take image, but it's appear for all products and producer

echo '<div class="woocommerce-product-gallery" style="background: #fdfd5a; padding: 1em 2em">';
echo '<span>THIS IS A TEST. YOU CAN ADD TEXT, IMAGES AND ANY HTML</span>';
echo'<img src="http://localhost/meumerkado/wp-content/uploads/2019/06/cesta_background.jpg"';
echo '</div>';
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock