Skip to content

Instantly share code, notes, and snippets.

@claudiosanches
Created December 1, 2012 20:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save claudiosanches/4185057 to your computer and use it in GitHub Desktop.
Save claudiosanches/4185057 to your computer and use it in GitHub Desktop.
WooCommerce - Custom Simple Product price format.
<?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