- Issue created by @filipetakanap
- 🇵🇹Portugal filipetakanap
I'm still having issues... Think the easiest way would be something like this in invoice.php
$orderA = $this->get('orders')->first()->entity->getState(); if ($this->getState()->getId() == 'pending' && $orderA == "payment_accepted") { /** @var \Drupal\commerce_number_pattern\Entity\NumberPatternInterface $number_pattern */ $number_pattern = $invoice_type->getNumberPattern(); if ($number_pattern) { $invoice_number = $number_pattern->getPlugin()->generate($this); $this->setInvoiceNumber($invoice_number); } }
I'm trying to get the order state "payment accepted" to generate a new invoice with a number.
But i don't know the code to get the order state