Bagisto Forum

    Bagisto

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

    How can I set default country in country dropdown in checkout page?

    General Discussion
    2
    7
    714
    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.
    • B
      bjsharma last edited by

          @foreach (core()->countries() as $country)
          @if($country->code=="NP")
          <option selected value="{{ $country->code }}">{{ $country->name }}</option>
          @else
          <option value="{{ $country->code }}">{{ $country->name }}</option>
          @endif
          @endforeach
      

      This didn't work.

      1 Reply Last reply Reply Quote 0
      • N
        Naresh-webkul last edited by

        Hello @bjsharma ,
        add your default country code to the component (checkout) at the following path:
        go to packages/Webkul/Shop/Resources/views/checkout/onepage.blade.php
        add value like country: 'IN' to address.billing{} array (line 140).

        Thank you.

        B 1 Reply Last reply Reply Quote 0
        • B
          bjsharma last edited by

          You mean:
          address: {
          billing: {
          address1: [''],
          country: ['NP'],

                                  use_for_shipping: false,
                              },
          

          But didn,t work.

          1 Reply Last reply Reply Quote 0
          • B
            bjsharma @Naresh-webkul last edited by

            @Naresh-webkul Thank u, it worked after i changed it in my custom theme.

            1 Reply Last reply Reply Quote 0
            • N
              Naresh-webkul last edited by

              Hi @bjsharma ,
              remove array [] from country field.
              thank you.

              B 1 Reply Last reply Reply Quote 1
              • N
                Naresh-webkul last edited by

                Your Welcome @bjsharma .

                1 Reply Last reply Reply Quote 0
                • B
                  bjsharma @Naresh-webkul last edited by

                  @Naresh-webkul removed [] and all done. Thank u

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