Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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
Comment #1
bmx269 CreditAttribution: bmx269 commentedAs 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.
Comment #2
rfayI've done a number of screencasts demonstrating how to use rules with Commerce Shipping 2.x now.
http://www.commerceguys.com/resources/articles/246
http://www.commerceguys.com/resources/articles/247
http://www.commerceguys.com/resources/articles/248
http://www.commerceguys.com/resources/articles/249
http://www.commerceguys.com/resources/articles/250
If those meet your needs, please mark this fixed.
Comment #3
rszrama CreditAttribution: rszrama commentedI'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. : )