Seems like Magento doesn't have a way to get all orders by shipping addresses. This is obviously because of the following:
- Magento doesn't store addresses as unique entities, this means every time there is an order, Magento will create a new entity for that address even if already exists and is exactly the same.
- Because its a new entity, every time an order is placed it will have its unique
entity_idwhich is then stored against the
sales_ordertable under the
shipping_address_idcolumn. This means we will not be able to easily check how many orders have been done under a specific address because they all have different
So has anyone every come across this before or can you think of a way of achieve this?
Here is some context why I need this.
We basically want a way to flag addresses as trusted if it has x amount of non-refunded orders between z timeframe. When a customer checks out the input address will be lookup on a table with trusted addresses if it is found then it is sent to our fraud system to do extra validations with the address set as trusted.