Forked from gabrielmerovingi/mycred-woo-price-append
Created
February 19, 2019 12:36
-
-
Save tharlab/ca3913b8de723e0461474d599c8e1d21 to your computer and use it in GitHub Desktop.
Append the product price in points to WooCommerce products.
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
/** | |
* Show Cost in Points | |
* Show the cost of a product in points next to the regular price. | |
* @version 1.0 | |
*/ | |
function mycred_pro_append_point_price( $rendered_price, $product ) { | |
if ( $product->get_price() > 0 ) { | |
$price = $product->get_price(); | |
// How many points does it take to get 1 store currency? | |
$exchange_rate = 100; | |
$mycred = mycred(); | |
$rendered_price .= '<small class="point-price">( ' . $mycred->format_creds( $price * $exchange_rate ) . ' )</small>'; | |
} | |
return $rendered_price; | |
} | |
add_filter( 'woocommerce_get_price_html', 'mycred_pro_append_point_price', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment