How could i apply a 10% discount to an entire order when a certain weight has been reached in the total order?

e.g. 500g weight order is made (can be 500g of one item or 500g made up of other items) - 10% is taken off the total price