Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Johannes Lantz 150 posts 830 karma points c-trib
    Dec 09, 2022 @ 09:37
    Johannes Lantz

    Backoffice advanced filter - Discount


    I was curious if it's possible to use the backoffice advanced filter to find orders with discount codes?


  • Matt Brailsford 4099 posts 22021 karma points MVP 9x c-trib
    Dec 09, 2022 @ 10:36
    Matt Brailsford

    Hi Johannes,

    Hmm, good question. I don't think we have one OOTB, but I think it should be possible.

    The advanced filter view is pluggable and so long as we have a filter option on our order query specification (which we have a Redeems method to check if it discount / gift card code is redeemed by an order), you can implement your own.

    I don't think I got round to documenting those, but if you create a class that extends OrderAdvancedFilterBase with an AdvancedFilterAttribute to define it's meta data (like so)

    [AdvancedFilter("discountCode", "Discount Code", "A discount code to search on", Group = "Order")]
    public class OrderDiscountCodeAdvancedFilter : OrderAdvancedFilterBase
        public override bool CanApply(string value)
            return !string.IsNullOrWhiteSpace(value);
        public override IQuerySpecification<OrderReadOnly> Apply(IQuerySpecification<OrderReadOnly> query, IOrderQuerySpecificationFactory @where, string value)
            return query.And(where.Redeems(value));

    in your IUmbracoBuilder or IVendrBuilder you can call


    I think this should do it.

  • Johannes Lantz 150 posts 830 karma points c-trib
    Dec 09, 2022 @ 11:00
    Johannes Lantz

    Thank you so much Matt! That works wonder!

Please Sign in or register to post replies

Write your reply to: