What are the Slack Archives?
It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hello again. On glue we want to get the shipping methods based on the destination country given by t
Hello again. On glue we want to get the shipping methods based on the destination country given by the request. In this case below, the shipment should go to germany{
"data": {
"type": "checkout-data",
"attributes": {
"idCart": "c317c11b-a342-53ce-8831-63189dc02122",
"customer": {
"email": "<mailto:bl@lol.de|bl@lol.de>",
"salutation": "Ms",
"firstName": "bla",
"lastName": "bla"
},
"billingAddress": {
"salutation": "Ms",
"firstName": "bla",
"lastName": "bla",
"address1": "sdsdsds 1",
"address2": "sdsdsds 1",
"address3": "sdsdsds 1",
"zipCode": "12345",
"city": "dfdfd",
"iso2Code": "DE",
"company": "sdsd",
"phone": "123454",
"isDefaultBilling": true,
"isDefaultShipping": true
},
"shippingAddress": {
"salutation": "Ms",
"firstName": "bla",
"lastName": "bla",
"address1": "sdsdsds 1",
"address2": "sdsdsds 1",
"address3": "sdsdsds 1",
"zipCode": "12345",
"city": "dfdfd",
"iso2Code": "DE",
"company": "sdsd",
"phone": "123454",
"isDefaultBilling": true,
"isDefaultShipping": true
},
"payments":
[
{
"paymentMethodName": "invoice",
"paymentProviderName": "DummyPayment"
}
]
`}` `}`
}
As you can see, we don’t provide any shipment methods in the first step, because we don’t know which one will be allowed for us.
For deciding wether if a shipping method is allowed or not, we wrote for every shipment method a plugin that implements
ShipmentMethodAvailabilityCheckerInterface
Somewhere in its business logic, we check for the shipping address which is unfortunately now per item base in
$item->getShipment()->getShippingAddress()->getIso2Code()
But getShipment() is null because we never provide a shipment method on the glue request like this
`"shipment": {` `"idShipmentMethod": 1` `}`
But we need the address of it which (in my opinion) shouldn’t stick to the provided shipment data.
So now we are in a kind of deadlock 🤔 We want to get all shipping methods that are allowed based on the address, but we have no address because we don’t provide any shipment which is mandatory for providing the address in the plugin.
Before it was quite easy because the shipping address wasn’t dependent on the provided shipping method. But this method
$quoteTransfer->getShippingAddress()
seems outdated …
Any ideas?
Comments
-
Hey Ingo,
Glue checkout does not support split delivery, it uses the old way of providing shipping address per quote, not per item.
Under the hood, the
ShipmentFacade::getAvailableMethodsByShipment()
is used to provide the shipping methods. Does this facade return the shipping methods you need to see in each case?It looks like the problem might be in the fact that you are looking for shipping address information in the item, but for Glue checkout it will never be set, the address you provide in the
checkout-data
payload will go to$quoteTransfer->getShippingAddress()
.0 -
Hi Eugenia,
getShippingAddress() seems deprecated and will maybe disappear in the next time 🤔 so i think i shouldn’t use this function anymore(?)0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 75 Spryker News
- 921 Developer Corner
- 781 Spryker Development
- 88 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 25 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random