From 958f297f7de931badd869b3aadab11254c4ca473 Mon Sep 17 00:00:00 2001 From: Rob Harings Date: Sat, 9 Sep 2017 14:11:44 +0200 Subject: [PATCH 1/5] 2906332 Refactor message handeling method --- modules/checkout/commerce_checkout.module | 1 + .../CheckoutPane/CompletionMessage.php | 57 +++++++++ .../CheckoutPane/CompletionMessages.php | 110 ++++++++++++++++++ ...erce-checkout-completion-message.html.twig | 4 + .../src/Kernel/CompletionMessagesTest.php | 47 ++++++++ 5 files changed, 219 insertions(+) create mode 100644 modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessages.php create mode 100644 modules/checkout/tests/src/Kernel/CompletionMessagesTest.php diff --git a/modules/checkout/commerce_checkout.module b/modules/checkout/commerce_checkout.module index a792b11b34..6ae4e5269d 100644 --- a/modules/checkout/commerce_checkout.module +++ b/modules/checkout/commerce_checkout.module @@ -25,6 +25,7 @@ function commerce_checkout_theme() { 'commerce_checkout_completion_message' => [ 'variables' => [ 'order_entity' => NULL, + 'completion_messages' => NULL, 'payment_instructions' => NULL, ], ], diff --git a/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php b/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php index fef9352aff..46e996395a 100644 --- a/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php +++ b/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php @@ -15,14 +15,71 @@ */ class CompletionMessage extends CheckoutPaneBase { + /** + * @var \Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CompletionMessages + */ + private $completionMessags; + + /** + * {@inheritdoc} + */ + public function __construct(array $configuration, $plugin_id, $plugin_definition, \Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowInterface $checkout_flow, \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager) { + parent::__construct($configuration, $plugin_id, $plugin_definition, $checkout_flow, $entity_type_manager); + $this->completionMessags = new CompletionMessages(); + } + /** * {@inheritdoc} */ public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) { + $this->preparePaneForm(); + $pane_form['#theme'] = 'commerce_checkout_completion_message'; $pane_form['#order_entity'] = $this->order; + $pane_form['#completion_messages'] = $this->completionMessags; return $pane_form; } + /** + * Prepares the necessary data for the completion messages. + */ + public function preparePaneForm() { + $this->populateCompletionMessages(); + } + + /** + * Gets the completion messages. + */ + private function populateCompletionMessages() { + $this->populateCompletionMessagesWithDefaultMessage(); + $this->populateCompletionMessagesWithLoggedInMessageIfLoggedIn(); + + $this->allowOthersToModifyMessages(); + } + + /** + * Gets the default completion message. + */ + private function populateCompletionMessagesWithDefaultMessage() { + return $this->completionMessags->addMessage($this->t('Your order number is @number.', ['@number' => $this->order->id()])); + } + + /** + * Populate the completion messages with the logged in message. + */ + private function populateCompletionMessagesWithLoggedInMessageIfLoggedIn() { + if (\Drupal::currentUser()->isAuthenticated()) { + $this->completionMessags->addMessage($this->t('You can view your order on your account page when logged in.')); + } + } + + /** + * Allow other modules to alter the messages. + */ + private function allowOthersToModifyMessages() { + \Drupal::moduleHandler() + ->alter('checkout_completion_messages', $this->completionMessags, $this->order); + } + } diff --git a/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessages.php b/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessages.php new file mode 100644 index 0000000000..e5a9c91998 --- /dev/null +++ b/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessages.php @@ -0,0 +1,110 @@ +position = 0; + } + + /** + * Return the current element + * + * @link http://php.net/manual/en/iterator.current.php + * @return mixed Can return any type. + * @since 5.0.0 + */ + public function current() { + return $this->messages[$this->position]; + } + + /** + * Move forward to next element + * + * @link http://php.net/manual/en/iterator.next.php + * @return void Any returned value is ignored. + * @since 5.0.0 + */ + public function next() { + ++$this->position; + } + + /** + * Return the key of the current element + * + * @link http://php.net/manual/en/iterator.key.php + * @return mixed scalar on success, or null on failure. + * @since 5.0.0 + */ + public function key() { + return $this->position; + } + + /** + * Checks if current position is valid + * + * @link http://php.net/manual/en/iterator.valid.php + * @return boolean The return value will be casted to boolean and then + * evaluated. Returns true on success or false on failure. + * @since 5.0.0 + */ + public function valid() { + return isset($this->messages[$this->position]); + } + + /** + * Rewind the Iterator to the first element + * + * @link http://php.net/manual/en/iterator.rewind.php + * @return void Any returned value is ignored. + * @since 5.0.0 + */ + public function rewind() { + $this->position = 0; + } + + /** + * Adds a message to the array. + * + * @param \Drupal\Core\StringTranslation\TranslatableMarkup $message + */ + public function addMessage(TranslatableMarkup $message) { + $this->messages[] = $message; + } + + /** + * Count elements of an object + * + * @link http://php.net/manual/en/countable.count.php + * @return int The custom count as an integer. + *

+ *

+ * The return value is cast to an integer. + * @since 5.1.0 + */ + public function count() { + return count($this->messages); + } +} \ No newline at end of file diff --git a/modules/checkout/templates/commerce-checkout-completion-message.html.twig b/modules/checkout/templates/commerce-checkout-completion-message.html.twig index 5c8727f8bc..5e6bfc8b6d 100644 --- a/modules/checkout/templates/commerce-checkout-completion-message.html.twig +++ b/modules/checkout/templates/commerce-checkout-completion-message.html.twig @@ -11,6 +11,10 @@ */ #}

+ {% for message in completion_messages %} + {{ message }} + {% endfor %} + {{ 'Your order number is @number.'|t({'@number': order_entity.getOrderNumber}) }}
{{ 'You can view your order on your account page when logged in.'|t }}
diff --git a/modules/checkout/tests/src/Kernel/CompletionMessagesTest.php b/modules/checkout/tests/src/Kernel/CompletionMessagesTest.php new file mode 100644 index 0000000000..ba42f4704b --- /dev/null +++ b/modules/checkout/tests/src/Kernel/CompletionMessagesTest.php @@ -0,0 +1,47 @@ +completionMessages = new CompletionMessages(); + } + + public function testAddMessage() { + $this->completionMessages->addMessage(t('Message 1')); + $this->completionMessages->addMessage(t('Message 2')); + + $this->assertCount(2, $this->completionMessages); + } + + public function testMessagesIterator() { + $this->completionMessages->addMessage(t('Message 1')); + $this->completionMessages->addMessage(t('Message 2')); + + $this->assertEquals('Message 1', $this->completionMessages->current()->render()); + $this->completionMessages->next(); + $this->assertEquals('Message 2', $this->completionMessages->current()->render()); + } + +} \ No newline at end of file From 102f6a153a316904e7bad6cd173c8502cc36ba5a Mon Sep 17 00:00:00 2001 From: Rob Harings Date: Sat, 9 Sep 2017 14:15:57 +0200 Subject: [PATCH 2/5] Remove duplicate documentation --- .../CheckoutPane/CompletionMessage.php | 4 +- .../CheckoutPane/CompletionMessages.php | 66 ++++++------------- ...erce-checkout-completion-message.html.twig | 2 +- .../src/Kernel/CompletionMessagesTest.php | 21 +++--- 4 files changed, 38 insertions(+), 55 deletions(-) diff --git a/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php b/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php index 46e996395a..867a39bdac 100644 --- a/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php +++ b/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php @@ -2,6 +2,8 @@ namespace Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane; +use Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowInterface; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Form\FormStateInterface; /** @@ -23,7 +25,7 @@ class CompletionMessage extends CheckoutPaneBase { /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, \Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowInterface $checkout_flow, \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, CheckoutFlowInterface $checkout_flow, EntityTypeManagerInterface $entity_type_manager) { parent::__construct($configuration, $plugin_id, $plugin_definition, $checkout_flow, $entity_type_manager); $this->completionMessags = new CompletionMessages(); } diff --git a/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessages.php b/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessages.php index e5a9c91998..51af9655a4 100644 --- a/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessages.php +++ b/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessages.php @@ -3,7 +3,6 @@ namespace Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane; use Drupal\Core\StringTranslation\TranslatableMarkup; -use Drupal\Core\TypedData\TranslatableInterface; /** * Acts as a container to collect all completion messages. @@ -13,7 +12,7 @@ class CompletionMessages implements \Iterator, \Countable { /** - * @var \Drupal\Core\TypedData\TranslatableInterface[] + * @var \Drupal\Core\StringTranslation\TranslatableMarkup[] */ private $messages; @@ -30,81 +29,58 @@ public function __construct() { } /** - * Return the current element + * Adds a message to the array. + * + * @param \Drupal\Core\StringTranslation\TranslatableMarkup $message + * The message to add. + */ + public function addMessage(TranslatableMarkup $message) { + $this->messages[] = $message; + } + + /** + * Gets the current message. * - * @link http://php.net/manual/en/iterator.current.php - * @return mixed Can return any type. - * @since 5.0.0 + * @return \Drupal\Core\StringTranslation\TranslatableMarkup + * The current message. */ public function current() { return $this->messages[$this->position]; } /** - * Move forward to next element - * - * @link http://php.net/manual/en/iterator.next.php - * @return void Any returned value is ignored. - * @since 5.0.0 + * {@inheritdoc} */ public function next() { ++$this->position; } /** - * Return the key of the current element - * - * @link http://php.net/manual/en/iterator.key.php - * @return mixed scalar on success, or null on failure. - * @since 5.0.0 + * {@inheritdoc} */ public function key() { return $this->position; } /** - * Checks if current position is valid - * - * @link http://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then - * evaluated. Returns true on success or false on failure. - * @since 5.0.0 + * {@inheritdoc} */ public function valid() { return isset($this->messages[$this->position]); } /** - * Rewind the Iterator to the first element - * - * @link http://php.net/manual/en/iterator.rewind.php - * @return void Any returned value is ignored. - * @since 5.0.0 + * {@inheritdoc} */ public function rewind() { $this->position = 0; } /** - * Adds a message to the array. - * - * @param \Drupal\Core\StringTranslation\TranslatableMarkup $message - */ - public function addMessage(TranslatableMarkup $message) { - $this->messages[] = $message; - } - - /** - * Count elements of an object - * - * @link http://php.net/manual/en/countable.count.php - * @return int The custom count as an integer. - *

- *

- * The return value is cast to an integer. - * @since 5.1.0 + * {@inheritdoc} */ public function count() { return count($this->messages); } -} \ No newline at end of file + +} diff --git a/modules/checkout/templates/commerce-checkout-completion-message.html.twig b/modules/checkout/templates/commerce-checkout-completion-message.html.twig index 5e6bfc8b6d..2b6fb3e9c0 100644 --- a/modules/checkout/templates/commerce-checkout-completion-message.html.twig +++ b/modules/checkout/templates/commerce-checkout-completion-message.html.twig @@ -12,7 +12,7 @@ #}

{% for message in completion_messages %} - {{ message }} + {{ message }}
{% endfor %} {{ 'Your order number is @number.'|t({'@number': order_entity.getOrderNumber}) }}
diff --git a/modules/checkout/tests/src/Kernel/CompletionMessagesTest.php b/modules/checkout/tests/src/Kernel/CompletionMessagesTest.php index ba42f4704b..6ad9f65221 100644 --- a/modules/checkout/tests/src/Kernel/CompletionMessagesTest.php +++ b/modules/checkout/tests/src/Kernel/CompletionMessagesTest.php @@ -1,10 +1,4 @@ completionMessages = new CompletionMessages(); } + /** + * Tests add message method. + */ public function testAddMessage() { $this->completionMessages->addMessage(t('Message 1')); $this->completionMessages->addMessage(t('Message 2')); @@ -35,6 +37,9 @@ public function testAddMessage() { $this->assertCount(2, $this->completionMessages); } + /** + * Tests the messages iterator. + */ public function testMessagesIterator() { $this->completionMessages->addMessage(t('Message 1')); $this->completionMessages->addMessage(t('Message 2')); @@ -44,4 +49,4 @@ public function testMessagesIterator() { $this->assertEquals('Message 2', $this->completionMessages->current()->render()); } -} \ No newline at end of file +} From c76c46bbdc99dda78912a733c77ad5a50db134ea Mon Sep 17 00:00:00 2001 From: gauravjeet Date: Thu, 14 Sep 2017 16:59:15 +0200 Subject: [PATCH 3/5] Update messages --- .../CheckoutPane/CompletionMessage.php | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php b/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php index 867a39bdac..821e0af9be 100644 --- a/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php +++ b/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php @@ -54,8 +54,8 @@ public function preparePaneForm() { * Gets the completion messages. */ private function populateCompletionMessages() { - $this->populateCompletionMessagesWithDefaultMessage(); - $this->populateCompletionMessagesWithLoggedInMessageIfLoggedIn(); + $this->populateCompletionMessagesWithAnonymousMessage(); + $this->populateCompletionMessagesWithAuthenticatedMessage(); $this->allowOthersToModifyMessages(); } @@ -63,16 +63,24 @@ private function populateCompletionMessages() { /** * Gets the default completion message. */ - private function populateCompletionMessagesWithDefaultMessage() { - return $this->completionMessags->addMessage($this->t('Your order number is @number.', ['@number' => $this->order->id()])); + private function populateCompletionMessagesWithAnonymousMessage() { + if (\Drupal::currentUser()->isAnonymous()) { + $this->completionMessags->addMessage($this->t('Your order number is @number.', ['@number' => $this->order->id()])); + $this->completionMessags->addMessage($this->t('You can view your order on your account page when logged in.')); + } } /** * Populate the completion messages with the logged in message. */ - private function populateCompletionMessagesWithLoggedInMessageIfLoggedIn() { + private function populateCompletionMessagesWithAuthenticatedMessage() { if (\Drupal::currentUser()->isAuthenticated()) { - $this->completionMessags->addMessage($this->t('You can view your order on your account page when logged in.')); + $this->completionMessags->addMessage( + $this->t( + 'Your order number is %order_number_with_link.', + ['%order_number_with_link' => $this->order->toLink($this->order->getOrderNumber())] + ) + ); } } From 5d1dbd30b2da86f2d44c42340edfff3f1e1937b4 Mon Sep 17 00:00:00 2001 From: Rob Harings Date: Thu, 14 Sep 2017 17:04:35 +0200 Subject: [PATCH 4/5] Test string updates --- .../tests/src/Functional/CheckoutOrderTest.php | 4 ++-- .../FunctionalJavascript/PaymentCheckoutTest.php | 14 +++++++------- .../CouponRedemptionPaneTest.php | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/checkout/tests/src/Functional/CheckoutOrderTest.php b/modules/checkout/tests/src/Functional/CheckoutOrderTest.php index 7ed0ccbc54..ad4d8c296a 100644 --- a/modules/checkout/tests/src/Functional/CheckoutOrderTest.php +++ b/modules/checkout/tests/src/Functional/CheckoutOrderTest.php @@ -162,7 +162,7 @@ public function testGuestOrderCheckout() { $this->assertSession()->pageTextContains('Billing information'); $this->assertSession()->pageTextContains('Order Summary'); $this->submitForm([], 'Pay and complete purchase'); - $this->assertSession()->pageTextContains('Your order number is 1. You can view your order on your account page when logged in.'); + $this->assertSession()->pageTextContains('Your order number is 1.'); $this->assertSession()->pageTextContains('0 items'); // Test second order. $this->drupalGet($this->product->toUrl()->toString()); @@ -198,7 +198,7 @@ public function testGuestOrderCheckout() { $this->assertCheckoutProgressStep('Review'); $this->submitForm([], 'Pay and complete purchase'); - $this->assertSession()->pageTextContains('Your order number is 2. You can view your order on your account page when logged in.'); + $this->assertSession()->pageTextContains('Your order number is 2.'); $this->assertSession()->pageTextContains('0 items'); } diff --git a/modules/payment/tests/src/FunctionalJavascript/PaymentCheckoutTest.php b/modules/payment/tests/src/FunctionalJavascript/PaymentCheckoutTest.php index 31221e0d97..9e1619afa4 100644 --- a/modules/payment/tests/src/FunctionalJavascript/PaymentCheckoutTest.php +++ b/modules/payment/tests/src/FunctionalJavascript/PaymentCheckoutTest.php @@ -266,7 +266,7 @@ public function testCheckoutWithExistingPaymentMethod() { $this->assertSession()->pageTextContains('Frederick Pabst'); $this->assertSession()->pageTextContains('Pabst Blue Ribbon Dr'); $this->submitForm([], 'Pay and complete purchase'); - $this->assertSession()->pageTextContains('Your order number is 1. You can view your order on your account page when logged in.'); + $this->assertSession()->pageTextContains('Your order number is 1.'); $order = Order::load(1); $this->assertEquals('onsite', $order->get('payment_gateway')->target_id); @@ -317,7 +317,7 @@ public function testCheckoutWithNewPaymentMethod() { $this->assertSession()->pageTextContains('Johnny Appleseed'); $this->assertSession()->pageTextContains('123 New York Drive'); $this->submitForm([], 'Pay and complete purchase'); - $this->assertSession()->pageTextContains('Your order number is 1. You can view your order on your account page when logged in.'); + $this->assertSession()->pageTextContains('Your order number is 1.'); $order = Order::load(1); $this->assertEquals('onsite', $order->get('payment_gateway')->target_id); @@ -360,7 +360,7 @@ public function testCheckoutWithDeclinedPaymentMethod() { $this->assertSession()->pageTextContains('Visa ending in 1111'); $this->assertSession()->pageTextContains('Expires 2/2020'); $this->submitForm([], 'Pay and complete purchase'); - $this->assertSession()->pageTextNotContains('Your order number is 1. You can view your order on your account page when logged in.'); + $this->assertSession()->pageTextNotContains('Your order number is 1.'); $this->assertSession()->pageTextContains('We encountered an error processing your payment method. Please verify your details and try again.'); $this->assertSession()->addressEquals('checkout/1/order_information'); @@ -393,7 +393,7 @@ public function testCheckoutWithOffsiteRedirectPost() { $this->assertSession()->pageTextContains('Johnny Appleseed'); $this->assertSession()->pageTextContains('123 New York Drive'); $this->submitForm([], 'Pay and complete purchase'); - $this->assertSession()->pageTextContains('Your order number is 1. You can view your order on your account page when logged in.'); + $this->assertSession()->pageTextContains('Your order number is 1.'); $order = Order::load(1); $this->assertEquals('offsite', $order->get('payment_gateway')->target_id); @@ -440,7 +440,7 @@ public function testCheckoutWithOffsiteRedirectGet() { $this->assertSession()->pageTextContains('Johnny Appleseed'); $this->assertSession()->pageTextContains('123 New York Drive'); $this->submitForm([], 'Pay and complete purchase'); - $this->assertSession()->pageTextContains('Your order number is 1. You can view your order on your account page when logged in.'); + $this->assertSession()->pageTextContains('Your order number is 1.'); $order = Order::load(1); $this->assertEquals('offsite', $order->get('payment_gateway')->target_id); @@ -483,7 +483,7 @@ public function testFailedCheckoutWithOffsiteRedirectGet() { $this->assertSession()->pageTextContains('Johnny FAIL'); $this->assertSession()->pageTextContains('123 New York Drive'); $this->submitForm([], 'Pay and complete purchase'); - $this->assertSession()->pageTextNotContains('Your order number is 1. You can view your order on your account page when logged in.'); + $this->assertSession()->pageTextNotContains('Your order number is 1.'); $this->assertSession()->pageTextContains('We encountered an unexpected error processing your payment. Please try again later.'); $this->assertSession()->addressEquals('checkout/1/order_information'); @@ -516,7 +516,7 @@ public function testCheckoutWithManual() { $this->assertSession()->pageTextContains('Johnny Appleseed'); $this->assertSession()->pageTextContains('123 New York Drive'); $this->submitForm([], 'Pay and complete purchase'); - $this->assertSession()->pageTextContains('Your order number is 1. You can view your order on your account page when logged in.'); + $this->assertSession()->pageTextContains('Your order number is 1.'); $this->assertSession()->pageTextContains('Sample payment instructions.'); $order = Order::load(1); $this->assertEquals('manual', $order->get('payment_gateway')->target_id); diff --git a/modules/promotion/tests/src/FunctionalJavascript/CouponRedemptionPaneTest.php b/modules/promotion/tests/src/FunctionalJavascript/CouponRedemptionPaneTest.php index 83cfd3a6d8..fb18d8ed1c 100644 --- a/modules/promotion/tests/src/FunctionalJavascript/CouponRedemptionPaneTest.php +++ b/modules/promotion/tests/src/FunctionalJavascript/CouponRedemptionPaneTest.php @@ -235,7 +235,7 @@ public function testCheckout() { $this->assertSession()->pageTextContains('$899.10'); $this->submitForm([], 'Pay and complete purchase'); - $this->assertSession()->pageTextContains('Your order number is 1. You can view your order on your account page when logged in.'); + $this->assertSession()->pageTextContains('Your order number is 1.'); $order_storage = $this->container->get('entity_type.manager')->getStorage('commerce_order'); $order_storage->resetCache([$this->cart->id()]); @@ -259,7 +259,7 @@ public function testCheckoutWithMainSubmit() { $this->assertSession()->pageTextContains('$899.10'); $this->submitForm([], 'Pay and complete purchase'); - $this->assertSession()->pageTextContains('Your order number is 1. You can view your order on your account page when logged in.'); + $this->assertSession()->pageTextContains('Your order number is 1.'); $order_storage = $this->container->get('entity_type.manager')->getStorage('commerce_order'); $order_storage->resetCache([$this->cart->id()]); From f08733f19be181a1edd4fc018332b42911515f83 Mon Sep 17 00:00:00 2001 From: Rob Harings Date: Thu, 14 Sep 2017 17:15:15 +0200 Subject: [PATCH 5/5] Order id instead of number. --- .../src/Plugin/Commerce/CheckoutPane/CompletionMessage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php b/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php index 821e0af9be..a0094251b9 100644 --- a/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php +++ b/modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php @@ -78,7 +78,7 @@ private function populateCompletionMessagesWithAuthenticatedMessage() { $this->completionMessags->addMessage( $this->t( 'Your order number is %order_number_with_link.', - ['%order_number_with_link' => $this->order->toLink($this->order->getOrderNumber())] + ['%order_number_with_link' => $this->order->toLink($this->order->id())] ) ); }