Union probably not right for this
If I correctly understood, this should give the desired result:

create table weborders (id int, total int , ts timestamp);
insert into weborders values
(1, 0, '20200101'),
(2, 5, '20200102'),
(3, 0, '20200103'),
(4, 3, '20200104');

with ct as
(
  select   0 as row_no, id, ts
  from     weborders
  where    total &gt; 0
  order by id desc limit 1
)
, ct2 as
(
  select   1 as row_no, id, ts
  from     weborders
  where    total = 0
  order by id desc limit 1
)
select id, ts
from
(
  select row_no, id, ts from ct
  union
  select row_no, id, ts from ct2
) a
order by row_no;


or alternatively:

select id, ts
from
(
 select 0 as row_no, id, ts
 from   weborders
 where id = (select max(id) from weborders where total &gt; 0)
 union
 select 1 as row_no, id, ts
 from   weborders
 where id = (select max(id) from weborders where total = 0)
) a
order by row_no;




id | ts                 
-: | :------------------
 4 | 2020-01-04 00:00:00
 3 | 2020-01-03 00:00:00



db&lt;>fiddle here

And another smart solution, thanks to @ypercubeᵀᴹ for this.

select distinct on (total &gt; 0)
         id, ts
from     weborders
order by (total &gt; 0), id desc ;


db&lt;>fiddle here