One of the shipping companies that my client will use works by distance. This company offers an api where you tell the pickup address and the shipping address. You also specify what type of package to carry (small or medium). When I have a complete address, I make the call to the API of this company and it returns the shipping cost to me.

Given the particularity of this shipping company, I would like to be able to specify the price of the shipping cost without depending on any shipping method of the system itself. Is this possible?

thanks in advanced


Yes this is definitely possible.

We don't use any of Commerce's in-built shipping stuff - fields or calculation, as it's too limited for our needs (not Commerce's fault - we have very complicated shipping requirements!).

You will want to write yourself a custom module with either a full custom shipping calculator, or an adjuster for shipping.

You'd use an adjuster if you don't need to present any options to the user, and a full shipping calculator if you do. If the latter, as long as you implement the interfaces for Rules and Methods, you can do just about anything you wants and present it to the user any way you want. Can be a little tough to get going, but is very flexible once you've got it working.

Docs for this are here: https://craftcms.com/docs/commerce/3.x/shipping-methods.html

  • Ok, thanks Jeremy for you response (: sorry for my delay in replying Dec 11 '20 at 10:22

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.