mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Refresh checkout totals after validation if needed
Refreshing the totals the same way as WC does this.
This commit is contained in:
parent
c03b3d86b5
commit
3c557907f2
5 changed files with 47 additions and 11 deletions
|
@ -288,12 +288,15 @@ class CreateOrderEndpoint implements EndpointInterface {
|
|||
return true;
|
||||
|
||||
} catch ( ValidationException $error ) {
|
||||
wp_send_json_error(
|
||||
array(
|
||||
'message' => $error->getMessage(),
|
||||
'errors' => $error->errors(),
|
||||
)
|
||||
$response = array(
|
||||
'message' => $error->getMessage(),
|
||||
'errors' => $error->errors(),
|
||||
'refresh' => isset( WC()->session->refresh_totals ),
|
||||
);
|
||||
|
||||
unset( WC()->session->refresh_totals );
|
||||
|
||||
wp_send_json_error( $response );
|
||||
} catch ( \RuntimeException $error ) {
|
||||
$this->logger->error( 'Order creation failed: ' . $error->getMessage() );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue