From 223aa6493dc83f0dda221be93a34c7a63437018a Mon Sep 17 00:00:00 2001 From: Kirill Braslavsky Date: Tue, 2 Mar 2021 19:41:18 +0200 Subject: [PATCH] display both WC and own messages --- .../js/modules/ActionHandler/CheckoutActionHandler.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/ppcp-button/resources/js/modules/ActionHandler/CheckoutActionHandler.js b/modules/ppcp-button/resources/js/modules/ActionHandler/CheckoutActionHandler.js index 4af23327a..ac3c363b0 100644 --- a/modules/ppcp-button/resources/js/modules/ActionHandler/CheckoutActionHandler.js +++ b/modules/ppcp-button/resources/js/modules/ActionHandler/CheckoutActionHandler.js @@ -39,7 +39,9 @@ class CheckoutActionHandler { }).then(function (data) { if (!data.success) { spinner.unblock(); - errorHandler.message(data.data.message, true); + //handle both messages sent from Woocommerce (data.messages) and this plugin (data.data.message) + const message = typeof(data.messages) !== 'undefined' ? data.messages : data.data.message; + errorHandler.message(message, true); return; } const input = document.createElement('input');