Skip to content

Instantly share code, notes, and snippets.

@marcusig
Created March 14, 2024 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusig/9e996ce6dbb39b97a95c039fb9143b1a to your computer and use it in GitHub Desktop.
Save marcusig/9e996ce6dbb39b97a95c039fb9143b1a to your computer and use it in GitHub Desktop.
Add 'From ' to a configurable product price
<?php
// Add a filter to the price, adding 'From ' to the price of a configurable product
add_filter( 'woocommerce_get_price_html', 'mkl_add_price_prefix', 20, 2 );
function mkl_add_price_prefix( $price, $product ) {
if ( ! function_exists( 'mkl_pc_is_configurable' ) || ! mkl_pc_is_configurable( $product->get_id() ) ) return $price;
return 'À partir de ' . $price;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment