Skip to content

Instantly share code, notes, and snippets.

@marcosfreitas
Forked from claudiosanches/functions.php
Created September 3, 2013 16:44
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 marcosfreitas/6426406 to your computer and use it in GitHub Desktop.
Save marcosfreitas/6426406 to your computer and use it in GitHub Desktop.
<?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