Given how a big part of this module is the ability to enable and disable shipping services via rules, it'd be nice if it came with some examples (default rules?) of how to do that.

I'm trying to figure it out now (the specific thing I want being disabling a shipping method if any of the products in an order are over certain size/weight limits), so I'll supply that as an example when I figure it out, but if anyone would like to add anything else in (or tell me how it works!) that'd be great :)

Comments

bmx269’s picture

As with the example Rules set in the http://drupal.org/node/1341740#comment-5249644 comment, we should have a Feature that is built to have all the countries in the world and states if possible. We could go as far as tackling it as region based, ie North America Rules Set, Europe Rules Set, etc. Who wants to get this going with me?

We would need to set a standard for the feature format, as well as Rules structure.

rfay’s picture

rszrama’s picture

Status: Active » Fixed

I'm going to assume Randy's tutorials shed light on the subject. For implementation details for your initial request, Rupert, you're basically looking at needing a custom coded condition that you can add to your default Shipping method Rule. I'd also recommend using a Weight field from the Physical Fields module if you aren't already using it.

The problem with trying to do this solely through Rules is that I don't see any way to loop over a list and check something on each item... so there's no way to iterate over the line items on an order looking for any products over a certain weight. I suppose theoretically what you could do through actions is use Rules to "Add a variable" that represents all products over a certain weight. Then loop over your line items and increment your variable for any product over the weight limit. After the loop, you'd pass the order and the product count to a separate component that has a condition to see if the product count was equal to 0 before enabling the services for the given method on the order you pass in.

At the end of the day... I think a custom condition would be easier. : )

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.