Update Pay Later amount on the cart page when cart total changes

This commit is contained in:
Alex P 2023-06-16 11:39:20 +03:00
parent 74611528b5
commit b6a85f0d13
No known key found for this signature in database
GPG key ID: 54487A734A204D71
3 changed files with 18 additions and 3 deletions

View file

@ -67,7 +67,12 @@ class CartScriptParamsEndpoint implements EndpointInterface {
try {
$script_data = $this->smart_button->script_data();
wp_send_json_success( $script_data['url_params'] );
wp_send_json_success(
array(
'url_params' => $script_data['url_params'],
'amount' => WC()->cart->get_total( 'raw' ),
)
);
return true;
} catch ( Throwable $error ) {