O'Reilly logo

PrestaShop Module Development by Fabien Serny

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating new carriers

Now that we have a working configuration form, we will have to create carriers. In our case, we will create two carriers, one with a classic delivery option and one with relay points.

If you don't know how a carrier works in PrestaShop, I first invite you to create some carriers manually in your administration panel. This will help you understand the method described in the upcoming code.

We will first add the install method in our module's main class, in which we will call a method named installCarriers:

public function install()
{
  if (!parent::install())
    return false;
  if (!$this->installCarriers())
    return false;
  return true;
}

Unfortunately, there is no native method to create carriers, even in the CarrierModule class. So, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required