asdriel
Member
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>';
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>';