Created
December 1, 2012 20:59
-
-
Save claudiosanches/4185057 to your computer and use it in GitHub Desktop.
WooCommerce - Custom Simple Product price format.
This file contains hidden or 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 | |
/** | |
* Custom simple product price format. | |
* | |
* Adds credit cart parcels in price html. | |
* | |
* @param string $price Old price format. | |
* | |
* @return string Price format with credit card parcels. | |
*/ | |
function cs_custom_simple_product_price_html( $price ) { | |
global $product; | |
$parcels = 10; // Edit the number of parcels here! | |
$parcel_price = $product->get_price() / 10; | |
$html = '<span class="parcels">' . $parcels . 'x </span>'; | |
$html .= woocommerce_price( $parcel_price ) . '<br />'; | |
$html .= '<span class="without-interest">' . __( 'sem juros' ) . '</span><br />'; | |
$html .= woocommerce_price( $product->get_price() ); | |
return $html; | |
} | |
add_filter( 'woocommerce_price_html', 'cs_custom_simple_product_price_html' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment