-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get shipping methods already filtered on carriers and countries and weight #41
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for your interest and contribution! I've got nothing to remark on the implementation of the API call, but have left some suggestions on the approach on a higher level. Let me know if you have questions or can use my assistance in finishing up!
Co-authored-by: Sjoerd Nuijten <[email protected]>
@Valerie-Tylski-Vincent Thanks for your diligent work! I pushed some minor adjustments like the one to make |
Some SendCloud contracts have a huge number of shipping methods.
This can be source of memory problems (code is stopped on line 114 of
vendor/jouwweb/sendcloud/src/Client.php
, because in this case, the result is too heavy to be decoded).While we can't filter more the result of shipping methods on this endpoint, we can use another endpoint, that is mentionned in this page of SendCloud documentation:
https://api.sendcloud.dev/docs/sendcloud-public-api/branches/v2/shipping-products/operations/list-shipping-products
The body given as response is a list of shipping methods grouped by "shipping products", that have common characteristics. I compared the 2 requests, the shipping IDs returned are the same if we keep the same filters.
The advantage of this endpoint is that we can filter with a lot of parameters (I set only some of possible parameters in
Client.php
, to avoid encomber the code with unused parameters, but we could add other parameters, depending to user needs).The disadvantage of this endpoint is that we can't have the prices with it. That's why I named the new function
getShippingMethodsWithoutPrice()
.