Patch the order with no shipping methods, instead of throwing an error

This commit is contained in:
Narek Zakarian 2024-07-18 16:11:52 +04:00
parent 8b5165ddfc
commit 694caac891
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7

View file

@ -97,15 +97,6 @@ class UpdateShippingEndpoint implements EndpointInterface {
$pu = $this->purchase_unit_factory->from_wc_cart( null, true );
$pu_data = $pu->to_array();
if ( ! isset( $pu_data['shipping']['options'] ) ) {
wp_send_json_error(
array(
'message' => 'No shipping methods.',
)
);
return false;
}
// TODO: maybe should patch only if methods changed.
// But it seems a bit difficult to detect,
// e.g. ->order($id) may not have Shipping because we drop it when address or name are missing.