Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
Woocommerce agrega separador de miles en el campo de precio personalizado

Quiero agregar un separador de miles en el campo de entrada personalizado en la página de productos de Woocommerce.

este es mi código:

 jQuery(document).ready(function () { jQuery(document).on('input', '.number-separator', function (e) { if (/^[0-9.,]+$/.test(jQuery(this).val())) { jQuery(this).val( parseFloat(jQuery(this).val().replace(/,/g, '')).toLocaleString('en') ); } else { jQuery(this).val( jQuery(this) .val() .substring(0, jQuery(this).val().length - 1) ); } }); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <input type="text" name="tmcp_textfield_6" class="number-separator" value="" >

Todo parece correcto, pero cuando agrego el producto al carrito solo se agrega la primera parte del precio.

Por ejemplo, cuando ingreso el número 5,000,000, solo se agregará el número 5 al carrito.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

del archivo de función

 // Woocommerce add thousand separator in custom price field add_filter('woocommerce_price_format', 'digitalize_price_format'); function digitalize_price_format($format) { $format['decimal_point'] = '.'; $format['thousand_sep'] = ','; return $format; }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!