I want to use the Order number rather than the order id. I'm using Commerce POS and it uses $commerce_order->id()to generate the id used in the receipt generated and receipt email sent. But in trying to use $commerce_order->getOrderNumber() it returns empty (even though that's what is used in commerce/modules/order/src/Mail/OrderReceiptMail.php). I expected that the Order object holds everything related to an order including the Order Number.

The confirmation email which is default to commerce produces the expected order number and formatted as defined by the Number pattern. What is right snippet to order number?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.