Question: Get The Total Amount To Be Used With Square App

Get The Total Amount To Be Used With Square App

Hello, I am trying to get the total payable amount using span id=total-payable. It is returning 0, I tried many different ways but still retuning 0. When I debug the code I see that span#t

R

reid123

Asked

Hello,

I am trying to get the total payable amount using span id=total-payable. It is returning 0, I tried many different ways but still retuning 0. When I debug the code I see that span#total-payable has the total value not 0. Can you please let me know why the id is returning 0? how can I get the total value?

Thank you!

  • MS

    Mian Saleem

    Answered

    Hello,

    If javascript you can get the amount with grand_total variable. You can try console.log(grand_total); in console to print the value.

    Thank you

  • R

    reid123

    Answered

    Thank you for the fast reply. it didn’t work, I tried to check the value by using alert but still the code didn’t work. I tried to replace it in my Square code and still didn’t work. Any idea why?

  • R

    reid123

    Answered

    The code to pass the value is the following var data = { amount_money: { amount: pay, currency_code: “USD” }, pay has to be a string. inString() didn’t work so I am assuming the grand_total doesn’t have a value or we aren’t accessing it correctly.

  • R

    reid123

    Answered

    Also, just to confirm the code should be inside index.php with this path themes/default/views/pos/index.php? correct?

  • R

    reid123

    Answered

    no worries, I was able to pass it in a different way! thank you!

  • MS

    Mian Saleem

    Answered

    Hello,

    The variable is declared in the index.php file and it should be available.

    I am glad to know that you have found the solution.

    Thank you for updating

  • Login to Reply