Created
March 14, 2024 08:10
-
-
Save marcusig/9e996ce6dbb39b97a95c039fb9143b1a to your computer and use it in GitHub Desktop.
Add 'From ' to a configurable product price
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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