I've been trying to add custom shipping methods to a Magento 2 webshop, using configurations in app/code/vendor/module/etc/config.xml
, app/code/vendor/module/etc/system.xml
and app/code/vendor/module/Model/Carrier/Shippingmethod.php
.
So, this all works, and I can select the shipping methods. Also, when NOT logged in, the checkout works fine and can get completed.
The problem is, when logged in with a (new) customer
, when using one of the custom shipping methods, it throws the following error:
'Please specify a shipping method' (freely translated from original language).
The console throws the following error:
When I go the following link:
http://mywebshop.com/rest/default/V1/carts/mine/payment-information
It says:
"User not authorized for %resources"
and a <trace>
tag with a few php files
:
Some research later, people talk about tokens and stuff
, but can't figure it out.
Best Answer
this possibly occurs because new customers do not have an address registered, I've pass throug problems with custom shipping too, see this question, maybe helps you.
And see my example of custom shipping method.
I hope it help