Is there a way where we could change the AJAX request to fetch shipping quote based on the State/Province selection instead of postal code?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

longwave’s picture

Category: support » feature

I think we will need to add options for this somewhere, we can't easily determine it automatically from the available rules.

jonloh’s picture

Yeap. An option for this AJAX feature would be great.

Prolly we could add this option somewhere in checkout pane configuration page? I'll see if I would be able to come up with the code to add this option into some configuration page.

Michael-IDA’s picture

Could really use this, as we do shipping quotes by State/Province not zip code.*

*Someone have an example Rule condition that uses zip codes?

Obviously one could do a huge OR as below, but a PHP array_search would have to be easier, if it's usable?

{ "rules_zone_01_zips" : {
    "LABEL" : "Zone 01 Zips",
    "PLUGIN" : "or",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : { "order" : { "label" : "order", "type" : "uc_order" } },
    "OR" : [
      { "data_is" : { "data" : [ "order:delivery-address:postal-code" ], "value" : "11111" } },
      { "data_is" : { "data" : [ "order:delivery-address:postal-code" ], "value" : "22222" } }
    ]
  }
}
MegaChriz’s picture

In rules, you can just use Data > Text comparison for the zone value (see image), but currently shipping costs are only updated when the postal code or country changes, or when an address is selected from the "saved addresses" (I may be wrong, but it looks like the shipping costs are not correctly updated when the customer selects an other address).

Michael-IDA’s picture

Yeah, I knew about the zone usage http://drupal.org/node/1447128 , but based upon a clean install, the shipping costs are only changed when the Country changes* or the Postal code field loses focus. And you're right, selecting from the drop down doesn't trigger shipping costs.**

And as a last tidbit, using the Postal code field, gives wonky results. Sometimes it triggers my "22222" zip code on checkout and sometimes it doesn't. In "Estimated shipping cost:" on cart it doesn't trigger either 11111 or 22222 (but does trigger on zone).

Best,
Sam

*And this seems useless, as the State/Province is re-set to "Select" so it can't pull up the correct shipping costs anyway.

**Oh, it's really hosed, well the drop down is. (Still with a clean install, no uc_address) Selected a drop down with Alabama and 11111 Postal code, no shipping costs triggered. Select another address Newfoundland (Canada) and 22222 Postal code, "Alabama" shipping cost is triggered (but not 11111 or 22222).

(will go open a ticket)

TR’s picture

Michael-IDA’s picture

Hi Tim,

I re-opened the bug report, as it is only dealing with bugs, not this request.

Best,
Sam

longwave’s picture

Status: Active » Closed (duplicate)