Skip to content

Instantly share code, notes, and snippets.

@claudiosanches
Created December 1, 2012 20:59
Show Gist options
  • Select an option

  • Save claudiosanches/4185057 to your computer and use it in GitHub Desktop.

Select an option

Save claudiosanches/4185057 to your computer and use it in GitHub Desktop.

Revisions

  1. claudiosanches created this gist Dec 1, 2012.
    25 changes: 25 additions & 0 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    <?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' );