# Agregar formato a campo cuotas

**URL:** <https://foro.wpargentina.org/t/agregar-formato-a-campo-cuotas/4568>\
**Category:** General\
**Created:** [21 Diciembre, 2021 01:11 UTC](https://foro.wpargentina.org/t/agregar-formato-a-campo-cuotas/4568 "2021-12-21T01:11:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gio\_Canaz](https://foro.wpargentina.org/user_avatar/foro.wpargentina.org/gio_canaz/32/2468_2.png) [@Gio\_Canaz](https://foro.wpargentina.org/u/Gio_Canaz)\
**Post date:** [21 Diciembre, 2021 01:11 UTC](https://foro.wpargentina.org/t/agregar-formato-a-campo-cuotas/4568/1 "2021-12-21T01:11:45Z")

</div>

Hola comunidad,  
Tengo el siguiente problema. Ocupe un codigo que encontre aqui en el sitio, y me ayudo bastante ahora bien, El precio no me sale con el formato dado por woocomerce.  
Como puedo editarlo para que me salga la coma de miles?

 ![image](https://foro.wpargentina.org/uploads/default/original/2X/8/8cd4f50a31992ecba08da490c0514f1f3f8cabe1.jpeg)

---

<div class="post-metadata">

**Author:** ![gonzalesc](https://foro.wpargentina.org/user_avatar/foro.wpargentina.org/gonzalesc/32/58_2.png) [@gonzalesc](https://foro.wpargentina.org/u/gonzalesc)\
**Post date:** [21 Diciembre, 2021 15:42 UTC](https://foro.wpargentina.org/t/agregar-formato-a-campo-cuotas/4568/2 "2021-12-21T15:42:07Z")

</div>

Hola.  
No sé que código haz usado, pero si usas la funcion wc\_price(), entonces WooCommerce se encarga de ponerlo en el formato correcto.

Saludos

---

<div class="post-metadata">

**Author:** ![Gio\_Canaz](https://foro.wpargentina.org/user_avatar/foro.wpargentina.org/gio_canaz/32/2468_2.png) [@Gio\_Canaz](https://foro.wpargentina.org/u/Gio_Canaz)\
**Post date:** [29 Diciembre, 2021 18:02 UTC](https://foro.wpargentina.org/t/agregar-formato-a-campo-cuotas/4568/3 "2021-12-29T18:02:09Z")

</div>

// FUNCION MUESTRA EL PRECIO DIVIDIDO 3 CUOTAS DE $  
add\_filter( ‘woocommerce\_get\_price\_html’, ‘change\_displayed\_sale\_price\_html’, 10, 2 );  
function change\_displayed\_sale\_price\_html( $price, $product ) {  
if( $product-\>is\_type(‘simple’) ){  
// Get product prices  
$regular\_price = (float) $product-\>get\_regular\_price(); // Regular price  
$sale\_price = (float) $product-\>get\_price(); // Active price (the “Sale price” when on-sale)

```
             // "Saving Percentage" calculation and formatting
             $precision = 0; // Max number of decimals
             if (empty($sale_price)) {
                $cuotaprecioregular = round ($regular_price / 3, $precision);
                $price .= sprintf( __('<p style="font-size:14px;color:#415161;" >3 cuotas de: $%s</p>', 'woocommerce' ), $cuotaprecioregular );
				 
             }
             else {
                $cuotapreciosale = round ($sale_price / 3, $precision);
                $price .= sprintf( __('<p style="font-size:14px;color:#415161;">3 cuotas de: $%s</p>', 'woocommerce' ), $cuotapreciosale );
				
             }
             }
        return $price;
    }

```

Hola gonzalesc, use este codigo para traer el precio dividirlo en 3 y mostrarlo por cada producto, pero no se por que no agarra el formato… si me puedas orientar seria genial… el sitio que tengo es planty.cl
