Created
February 18, 2014 13:09
-
-
Save kloon/9070636 to your computer and use it in GitHub Desktop.
WooCommerce add weight unit after 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 R xx.xx per KG | |
add_action( 'woocommerce_price_html', 'wc_custom_price', 10, 2 ); | |
function wc_custom_price( $price, $product ) { | |
return sprintf( __( '%s per KG', 'woocommerce' ), woocommerce_price( $product->get_price() ) ); | |
} | |
?> |
Thanks!
You get your sites weight unit using the following.
get_option('woocommerce_weight_unit' )
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@brandonecarr I am using the Flatsome theme where do I go to add the above code?
Thank you!