Copied to clipboard

Flag this post as spam?

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


  • Nalysa 25 posts 165 karma points
    27 days ago
    Nalysa
    0

    Limit Discount Usage for Each Member

    Hi,

    I need to limit the discount usage so that each member can only apply the discount once. Is it possible to do this?

    Thanks

  • Matt Brailsford 2807 posts 14331 karma points MVP 7x c-trib
    26 days ago
    Matt Brailsford
    100

    Hi Nalysa

    Not out of the box but you could create your own discount rule https://vendr.net/docs/core/1-3-0/key-concepts/discount-rules-and-rewards/

    You could create a discount code discount, then create a new rule which checks the database for orders with the same customer reference that are using this discount. If the number exceeds the allowed amount then fail the rule, thus the discount won’t apply.

    Hope this helps

    Matt

  • Nalysa 25 posts 165 karma points
    25 days ago
    Nalysa
    0

    Hi Matt, thanks for your help

    Now I face some issues:

    1. How to set the path for labelView? For example, I created a folder named Rules and a view file under it. I've tried with LabelView = "~/rules/example.html" but it doesn't work, it can't find the file specified Request error: The URL returned a 404 (not found).

    2. How to get the current discount code in the OrderDiscountRuleProvider? The problem occurs when more than one discount code is applied. Currently I can only get all the discount codes from the order. I don't know which code should be checked with my custom discount rule. Should I check all the codes where isFulfilled is false?

  • Matt Brailsford 2807 posts 14331 karma points MVP 7x c-trib
    25 days ago
    Matt Brailsford
    0

    Hi Nalsya,

    1) In chrome dev tools can you see what URL is being requested? And, is that URL where your label view is located? It might be that you need to exclude the ~

    2) Hmm, good question. It looks like we do pass a DiscountRuleContext but this doesn't currently hold a reference to the discount which I think this probably could / should. I've reported this on our issue tracker here https://github.com/vendrhub/vendr/issues/189 and have already created a patch for it that will be in version 1.3.1, if you want to test this prior to release, you can find a beta build on our CI NuGet feed at https://nuget.outfield.digital/unstable/vendr/v3/index.json, you'll want to try the 1.3.1-beta0009 build (all beta builds will be upgradable to final release builds)

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft