I have the shipping method "Flatrate" enabled in backend. So, as expected, it is available in frontend, too. But this shipping method should only be available in backend.
Of course, I already googled for this: How to hide a shipping method in front end and visible on admin section Magento 2?
But this doesn't work for me. I have my own module and namespace already and created the di.xml file. This file is for dependency injection, ok. But what other files do I have to create and what's the content of the files and the di.xml?
That's what I have:
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\OfflineShipping\Model\Carrier\Flatrate" type="MyNameSpace\MyModule\Model\Carrier\Flatrate" /> </config>
// no content - I just don't know what to do here...