Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Specify currency and locale while adding item to cart using Web API

    General Discussion
    4
    7
    430
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      drimtim5390 last edited by

      How to specify currency when adding or removing item from cart using Web API. Currently it always returns prices in default currency

      1 Reply Last reply Reply Quote 0
      • P
        prateek-webkul last edited by

        Hello @drimtim5390,

        Can you elaborate more about your query...

        1 Reply Last reply Reply Quote 0
        • D
          drimtim5390 last edited by drimtim5390

          Of course, according to the documentation, to add items to cart I should send following data via post request:
          product_id
          quantity
          is_configurable
          Currently, I have 2 locales and 2 currencies. When I use this API, response is adjusted to current locale I'm using. For example, if my current locale is EN, product names, description and others come to in EN. But the same is not happening for currencies.
          Do I make myself clear?

          1 Reply Last reply Reply Quote 0
          • V
            Vaishali Agarwal last edited by

            Hi @drimtim5390

            Have you enabled both locale and currency in channel configuration?? otherwise, the default locale will show in response.

            1 Reply Last reply Reply Quote 0
            • D
              drimtim5390 last edited by

              Yes I did. Locale and currency switchers in website are working properly.

              1 Reply Last reply Reply Quote 0
              • R
                rahul last edited by

                Hello @drimtim5390

                There is also API for switching locale and currency, use that API to switch this one.

                Then selected currency will be used while adding product in cart.

                1 Reply Last reply Reply Quote 0
                • D
                  drimtim5390 last edited by drimtim5390

                  @rahul I tried that too. It changes locale and currency in session and in a web page after reloading, but it doesn't change currency used for calculations in API. If possible, please, can you give a little explanation about these fields in response of cart object.
                  7b65a3d6-2c88-4e73-b129-a46410aa0477-image.png

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post