IN WooCommerce I am using the code of this tread to display with a short code the product prices from a defined product ID. But it don\'t really do what I want. Here is that
OK, a friend of me helped me, and gave me the good code. If it help someone else ... Here it is:
function so_30165014_price_shortcode_callback( $atts ) {
$atts = shortcode_atts( array('id' => null,), $atts, 'bartag' );
$html = '';
if( intval( $atts['id'] ) > 0 && function_exists( 'wc_get_product' ) ){
$_product = wc_get_product( $atts['id'] );
$price = $_product->get_price();
$regular_price = $_product->get_regular_price();
$price_format = number_format($_product->get_price(), 2, '.', ',');
$regular_price_format = number_format($_product->get_regular_price(), 2, '.', ',');
if($price != $regular_price){
$html .= "".$regular_price_format." €"."";
}
$html .= " ". $price_format." €"."";
}
return $html;
}
add_shortcode( 'woocommerce_price', 'so_30165014_price_shortcode_callback' );
bye !