Bagisto Forum

    Bagisto

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

    Set price based on country

    General Discussion
    2
    2
    190
    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.
    • ?
      A Former User last edited by

      Hi, for example I have some country arrays, how could I set the price depending on the country?
      For example, I use this function but I don't get the location from the country basket.
      How can I proceed?

      $area1 = 'Hungary';
              
              $area2 = array('Czechia', 'Slovakia', 'Slovenia', 'Bulgaria', 'Serbia');
              
              $area3 = array('Poland', 'Germany', 'Switzerland', 'Netherlands',
                              'Liechtenstein', 'Austria', 'Italy', 'Croatia');
                              
              $area4 = array('Denmark', 'France', 'United Kingdom', 'Irland', 'San Marino',
                              'Vatican', 'Mocano', 'Portugal', 'Spain', 'Canary Islands');
                              
              $area5 = array('Greece', 'Andorra', 'Gibraltar', 'Sweden', 'Finland', 'Norway',
                              'Malta', 'Cyprus', 'Estonia', 'Lithuania', 'Latvia', 'Turkey');
      
              switch ($cart->shipping_address->country)
              {
                  case $area1:
                      $object->base_price = 18;
                  break;
      
                  case array_search($cart->shipping_address->country, $area2):
                      $object->base_price = 18;
                  break;
      
                  case array_search($cart->shipping_address->country, $area3): 
                      $object->base_price = 8;
                  break;
      
                  case array_search($cart->shipping_address->country, $area4): 
                  break;
      
                  case array_search($cart->shipping_address->country, $area5): 
                  break;
              }
      

      Or I tried with ifs but it doesn't work, I get error 500 when I want to post.
      He may not find the country.
      How would you proceed to set a price depending on the country?

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

        Hi @DaniD,

        This is something that you are customizing and you should be familiar with the basics. If you want some customization you can contact Webkul for support.

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