Display variable product price (sale and not) THIRD REPRISE

Hi,
in reference to the ticket Display variable product price (sale and not) I contact you to find out if the bug has been solved.
It’s been 7 months since the request was opened and I hope the bug has been fixed.
The situation is unbearable with my client (he is right, such a bug is not acceptable) and I would like to know if there is a possibility to solve at least with a workaround.
Thanks

Hello @scenaryo,

Thanks for updating in! As @Alexander have mentioned that when using variable products, Dynamic Content will always reference the main product. Regretfully at this time, it isn’t supported to access the sub products. We highly recommend that if you want to get a consistent price, the Add to Cart Form element is the best option.

Best Regards.

Hi @ruenel,
the problem is not in the product detail page but in the categories page (https://www.brighindi.it/negozio/).
Antonio

Hi Antonio,

The Add to Cart Form is the only alternative solution that will work for every Archive page like Category, Tags and etc.

Thanks

The “Add to card” form is not a valid option in my opinion, so I solved the problem by creating two shortcodes:

function originale() {
ob_start();
global $product;
$prezzooriginalebasso = $product->get_variation_regular_price( ‘min’, true );
$prezzooriginalealto = $product->get_variation_regular_price( ‘max’, true );
if ($prezzooriginalebasso == $prezzooriginalealto) {
echo ‘€’,$prezzooriginalebasso;
} else {
echo ‘Da €’,$prezzooriginalebasso,’ - ',‘A €’,$prezzooriginalealto;
}
$content = ob_get_clean();
return $content;
}
add_shortcode(‘originale_scenaryo’, ‘originale’);

function scontato() {
ob_start();
global $product;
$prezzobasso = $product->get_variation_price( ‘min’, true );
$prezzoalto = $product->get_variation_price( ‘max’, true );
if ($prezzobasso == $prezzoalto) {
echo ‘€’,$prezzobasso;
} else {
echo ‘Da €’,$prezzobasso,’ - ',‘A €’,$prezzoalto;
}
$content = ob_get_clean();
return $content;
}
add_shortcode(‘scontato_scenaryo’, ‘scontato’);

Now everything’s fine.
Antonio

Hi Antonio,

Glad that you are able to find a solution for that.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.