1

Want to discuss about issue i faced and suggestions on it.

In quote_shipping_rate table's column code's allowed length is 255 but in quote_address table's column shipping_method's length is 40 only.

So when setting carrier and method in shipping method it combines both and saving in table quote_shipping_rate.

So here if combined code length exceeds 40 character then loosing characters from index 41.

With this configuration i can reach checkout payment page. But after that i am getting "An error occurred on the server. Please try to place the order again"

Preconditions

  1. List item
  2. Magento Version : 2.1.6 (community-edition)
  3. PHP : 7.0.24
  4. MySQL : 5.7.19

Steps to reproduce

  1. Add new shipping method Reference for Creating New Shipping Method
  2. Try checkout by selecting this shipping method
  3. At Payment checkout step error will be triggered

Expected result

  1. It should place order successfully

Suggested Solution

  • Increase quote_address table's column shipping_method's length from 40 to 255 (It should be same as quote_shipping_rate table's column code's length 255)
  • The error is not catchable so i am suggesting this update.

Original bug on github.

  • Very strange answer from magento team. Seems they do not want to improve their platform for developers. – Siarhey Uchukhlebau Dec 7 '17 at 12:34
  • Yes that bug is also reported by me. After getting strange answer only i posted it here so community can give their thoughts. – Ankur R Dec 8 '17 at 4:11
1

There two ways to prevent this kind of error:

  1. Increase field size (quote_address table's column shipping_method size)
  2. Decrease carrier_method code length

In my custom module where shipping methods can be created dynamically I just limit it's length to 19 symbols: 19 symbols for the Carrier code + 1 symbol for the "_" + 19 symbols for the Method code, so it always has length <= 39.

I think 19 symbols for the codes is enough to suite your needs.

PS: I hope that the Magento team will fix this error and make all the fields to a length of 255 characters in one of the following updates.

Note: just checked this in the version 2.2.1 (Enterprise & Community) and found that quote_address.shipping_method column has type varchar(120)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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