1

I am using Commerce FedEx to retrieve quotes at checkout and using a SmartPost setting that requires packages to be over 1lb. to return a quote from FedEx. I need to have the order shipping weight from Commerce Physical Products default to 1lb. for the entire order weight if the order weight is under 1lb. at the time of checkout. I do not want to make all of the products a minimum of 1lb. due to inaccurate quotes if multiple items are ordered so I am looking into a solution with Rules, but cannot seem to get an Action that will allow me to do this.

Example: One product is 0.25lbs. When two are ordered, the shipping weight should be 1lb. at checkout to receive a quote. When six are ordered, the shipping weight should be 1.5lbs.

1 Answer 1

1

You can use HOOK_commerce_fedex_rate_request_alter(&$request, $order) to alter the request before it goes out:

function MYMODULE_commerce_fedex_rate_request_alter(&$request, $order) {
    // Test this value and set it to whatever you'd like.
    $request['RequestedShipment']['RequestedPackageLineItems'][0]['Weight']['Value'] = 1;
    $request['RequestedShipment']['RequestedPackageLineItems'][0]['Weight']['Units'] = 'LBS';
}

Just test the value and update it if you want.

1
  • Thanks for the answer, I was able to write an if statement to get items under 1lb to have the actual amounts. This above will make everything 1lb even if over. There was one adjustment that needed made below, if you update your answer I will accept it. $request['RequestedShipment']['RequestedPackageLineItems'][0]['Weight']['Units'] = 'LB';
    – Birdeye
    Commented Oct 29, 2015 at 17:47

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.