This commit is contained in:
Timmy Crawford 2020-04-08 08:19:38 -07:00 committed by GitHub
parent 94eec721c0
commit 28a43f18c1
1 changed files with 5 additions and 0 deletions

View File

@ -27,6 +27,11 @@ class ShippingRates extends Component {
}
getShippingMethods( zone, type = null ) {
// Sometimes the wc/v3/shipping/zones response does not include a methods attribute, return early if so.
if ( ! zone || ! zone.methods || ! Array.isArray( zone.methods ) ) {
return [];
}
if ( ! type ) {
return zone.methods;
}