2

I am using Drupal Commerce 7. I need to set the shipping price to zero when a field of product is enabled/checked (for example free ship field).

I know I should use Rules and Collecting shipping rates for an order event is suitable for my job, but I really don't know how to set up a condition to check if my field is enabled or has a specific value.

I can set the free ship field widget as check box with enable/disable or select box with 2 value, whichever fits my needs. But my problem is how to set the condition according the value of product field.

Thanks for your attention

1 Answer 1

0

How about this: In shipping calculation rule see if can get the following conditions.

  1. Use execute php code, check in the php if can use $commerce_order
  2. If can then loop through all product line items in the order load them check the field value.
  3. On basis of condition return True so implement the action or false to not.
9
  • 1
    can you explain more please
    – Yuseferi
    Dec 31, 2013 at 11:44
  • what action I select in operation ? and which data selector?
    – Yuseferi
    Dec 31, 2013 at 11:45
  • I think php code in not suitable idea, maybe left it for last method.
    – Yuseferi
    Dec 31, 2013 at 11:54
  • you can start modifying any example shipping rule, so it will have shipping action by default and you will be simply turning it on or of using php code in condition of rule, but yeah keeping it as last option will be best.
    – arpitr
    Dec 31, 2013 at 20:01
  • can you do it and export you rules?
    – Yuseferi
    Dec 31, 2013 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.