• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
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 8 Jun 2020, 09:30

        @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 8 Jun 2020, 13:52

      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 9 Jun 2020, 07:03 Reply Quote 0
      • B
        bjsharma last edited by 9 Jun 2020, 03:57

        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 9 Jun 2020, 07:03

          @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 9 Jun 2020, 07:07

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

            B 1 Reply Last reply 9 Jun 2020, 07:08 Reply Quote 1
            • N
              Naresh-webkul last edited by 9 Jun 2020, 07:08

              Your Welcome @bjsharma .

              1 Reply Last reply Reply Quote 0
              • B
                bjsharma @Naresh-webkul last edited by 9 Jun 2020, 07:08

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

                1 Reply Last reply Reply Quote 0
                1 out of 7
                • First post
                  1/7
                  Last post