'ClientReference' => ($this->options['clientref'] ? $this->options['clientref'] .'-'. : '').$this->filterOrderId($order)
Use this.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, how could a condition be done if clientref is null displays only orderId without a hyphen. well thank you
'ClientReference' => $this->options['clientref'] .'-'. $this->filterOrderId($order)
Use this:
'ClientReference' => implode(' - ', array_filter([$this->options['clientref'], $this->filterOrderId($order)]));
Whenever either $this->options['clientref'] or $this->filterOrderId($order) is falsey, they will be removed from the array, so implode will not have 2 items to put the hyphen between.
Please or to participate in this conversation.