Skip to content

Instantly share code, notes, and snippets.

@wphelpdesk-gist
Last active October 17, 2018 09:31
Show Gist options
  • Save wphelpdesk-gist/4a0252f3bae695954327b644167fda77 to your computer and use it in GitHub Desktop.
Save wphelpdesk-gist/4a0252f3bae695954327b644167fda77 to your computer and use it in GitHub Desktop.
Wijzig de weergave van de product prijs in WooCommerce wanneer een product variabel is met een minimum en maximum prijs. Meer informatie en ondersteuning via https://wphelpdesk.nl/artikel/woocommerce-vanaf-prijs/
<?php
//Vanaf hier Kopiëren
/**
* Toont de tekst "Vanaf" wanneer er een verschil is tussen
* $product->min_variation_price EN $product->max_variation_price
* Geschikt voor WooCommerce versie 3, deze code kan je plakken in de functions.php van je thema
* Version: Woocommerce 3.0
*/
add_filter('woocommerce_variable_price_html','wphelpdesk_variate_prijs_verschil', 10, 2);
function wphelpdesk_variate_prijs_verschil( $price, $product ) {
if (count($product->get_children()) > 1) {
// De tekst 'Vanaf' is te wijzigen naar het woord dat je wilt weergeven
// Zorg wel dat je de '' laat staan!
$price = '<span class="from">' . __('Vanaf') . '</span> ';
$price .= woocommerce_price($product->price);
}
return $price;
}
// Tot hier Kopiëren
?>
@Sfaantje
Copy link

Hi there,

Code works perfectly, only my prices are exclusive of VAT. So I see the prices from without the VAT. Can this be adjusted?

Greetings,

Sfaantje

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment