• Resolved lucianfers

    (@lucianfers)


    Hi!

    I’m using this plugin and I’m very happy with it. I work selling wallpapers, and I use the plugin for this, but I’ve encountered some issues.

    I’m from Brazil, where we use a comma (,) as the decimal separator. However, the plugin currently uses a dot (.) as the decimal separator. When customers use a comma, the final value of the calculation is incorrect, resulting in a different value than when using a dot.

    I would like to know if it’s possible to fix the decimal separator so that the plugin only accepts the comma (,) as a valid decimal separator, or if there’s a way to configure the plugin to correctly handle the comma.

    The goal is for the customer to only enter numbers with a comma as the decimal separator, without affecting the calculation of the price.

    Thank you in advance, and I look forward to your response.

    Best regards,
    Luciano Fers

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter lucianfers

    (@lucianfers)

    I resolve this insue by myself. I create a custom plugin with js and works for me. I’m was thinking to buy the Custom Dynamic SKU add-on but i think the support is dead for this plugin, its better to try by myself again. If someone need, there is my code:

    function adicionar_script_formatacao_campos() { ?> <script> document.addEventListener('DOMContentLoaded', function() { // Selecione os campos de entrada de largura e altura const larguraField = document.querySelector('input[name="uni_cpo_valor_largura"]'); const alturaField = document.querySelector('input[name="uni_cpo_valor_altura"]'); function formatInput(event) { // Remover todos os caracteres n?o numéricos e ponto let value = event.target.value.replace(/[^\d.]/g, ''); // Permite números e ponto // Verificar se o valor tem mais de 2 dígitos if (value.length > 2) { // Inserir o ponto entre os dois últimos dígitos value = value.slice(0, -2) + '.' + value.slice(-2); // Exemplo: 12345 -> 123.45 } // Garantir que o ponto seja inserido event.target.value = value.replace(',', '.'); // Substitui qualquer vírgula por ponto } // Adicionar o evento 'input' aos campos de largura e altura if (larguraField) larguraField.addEventListener('input', formatInput); if (alturaField) alturaField.addEventListener('input', formatInput); }); </script> <?php } // Enfileirar o script para ser carregado no footer add_action('wp_footer', 'adicionar_script_formatacao_campos');


Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.