Support » Plugin: AWD Weight/Country Shipping for WooCommerce » Separate shipping for states/provinces

  • Hi,

    I know that someone posted something similar for Italy’s Island…

    But it would be great to be able to choose given states/provinces for a specific Country.

    I live in Canada (province of Quebec) and we have a company that offers very good rates but ONLY for provinces of Ontario and Quebec… So it would be great to have the option to choose specific provinces!

    Otherwise, what a great plugin! 🙂

    http://wordpress.org/extend/plugins/awd-weightcountry-shipping/

Viewing 15 replies - 1 through 15 (of 34 total)
  • Ya right,

    If we have option to add state to country than it will helpful …

    Admin ,
    Can you add shipping cost for STATES?

    My business is limited to One country only…I want to setup Shipping cost for states only….

    Thanks…

    Hi,

    After 6 Days no one ready to reply??????

    Hi,

    I modified the plugin to do what you need. It took me a couple of hours.

    I only need to sell in one country so it wasn’t too difficult. Making it work for several countries would be more complex.

    I’m not sure where to post all the code…is there a way to send messages to other users?

    Mantish,

    Thanks for reply…

    If possible to sell in different state than good(Limited to one country only),

    which information u need?

    My country is INDIA.

    thanks.

    chetan0412, here’s what I did:

    First, replace all instances of country(ies) to state(states)

    Second, delete all functions or lines where sync_states is mentioned

    Third, change display_state_groups() function into this:

    function display_state_groups() {
    
    	global $woocommerce;
    	$number = $this->state_group_no;
    
    	$base_country = $woocommerce->countries->get_base_country();
    
    	for($counter = 1; $number >= $counter; $counter++) {
    
    		$this->form_fields['states'.$counter] =  array(
    			'title'     => sprintf(__( 'State Group %s', 'woocommerce' ), $counter),
    			'type'      => 'multiselect',
    			'class'     => 'chosen_select',
    			'css'       => 'width: 450px;',
    			'default'   => '',
    			'options'   => $woocommerce->countries->get_states( $base_country )
    		);
    	}
    }

    hope it works for you

    Dear mantish,

    Thanks for prompt response..thanks again,

    Dear m beginner.. mstill not understanding what to do..

    1. Replace all instances of country(ies) to state(states)
    Q- where ? in shipping-awd.php? or class-wc-countries.php?

    2. delete all functions or lines where sync_states is mentioned
    Q- where ? in shipping-awd.php? or class-wc-countries.php?

    and third also..

    Q- where ? in shipping-awd.php? or class-wc-countries.php?

    if this change is applicable to shipping-awd.php in only than send me to my mail [ redacted, support is offered via the forum and not email ]

    again thank you so much…

    Hi,

    all changes should be made in the plugin file: shipping-awd.php

    thanks i ll try to complete..

    Luci_Fernandez

    (@luci_fernandez)

    This is exactly what I need, mantish, thank you very much!

    florbv

    (@florbv)

    hello mantish!

    I’ve tried doing your fix mentioned above but unfortunately I got a fatal error stating that Call to a member function get_states() on a non-object in…./shipping-awd.php on line 138

    Hope you can help me on this. Thank you.

    florbv

    (@florbv)

    Than happens when I click the woocommerce > settings link

    riyota

    (@riyota)

    mantish thanks for the snippet, just what I needed, and to take out the sync parts.
    I’m also trying to adjust the extension to make it into flat rate state based shipping extension. So I would like groups of states to have different flat rates for shipping. I tried to change in the function pick_smallest_rate but my change just made all shipping to become 1 in my case 1 yen. Would appreciate if someone could direct me in a correct direction.

    function pick_smallest_rate($rates,$weight) {
    
      if($weight == 0) return 1; // changed this return to 1 from 0 
    
            if( sizeof($rates) > 0) foreach($rates as $key => $value) {
    
                    if($weight <= $value[0]) {
                        $postage[] = $value[1];
                    }
                    $postage_all_rates[] = $value[1];
            }
    
            if(sizeof($postage) > 0) {
                return min($postage);
                    } else {
                    if (sizeof($postage_all_rates) > 0) return max($postage_all_rates);
                    }
            return false;
        }
    mantish

    (@mantish)

    florbv, if you post your code somewhere I’d take a look.
    riyota, I think your problem is that orders have 0 weight. Maybe commenting that first line is all that’s needed to make it work.

    florbv

    (@florbv)

    thnx for the response mantish.

    I’ve tried to do it again(the 3 steps you’ve mentioned) but now I am getting a parsing error something like this: T_PUBLIC…I guess this is all about deleting the sync_states function and lines. maybe I just left an open bracket or parenthesis or something…but I couldn’t figure it out. How may you help me this this pls? Where can I post my code for you to check?

Viewing 15 replies - 1 through 15 (of 34 total)
  • The topic ‘Separate shipping for states/provinces’ is closed to new replies.