Announcement

Collapse
No announcement yet.

Dynamic coupon codes?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Dynamic coupon codes?

    We want to create a page to list various limited coupons. Limited in usage and with fairly short expiration dates.
    Would there be a way to hide or gray-out coupons (codes) that have expired or have reached their usage limit?
    Has anyone done anything like this?
    pat
    http://lockitt.com

    #2
    You should probably use the Claude or Codex Page Builder skills to build something that gets you 99% of the way there. The only thing I don't think it would be able to do is keep count of usages, but sometimes it surprises me.

    Have you played with that at all?

    You can download the skills from here: https://docs.miva.com/developer/addi...rces/mivalabs/

    Then just prompt what you want and it will build it. I find that you prompt, it builds, you test, it's close, you do another round until you get what you want.
    Thanks,

    Rick Wilson
    CEO
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      I haven't run this through the paces yet, but it just built this for me.

      Notes from Claude (USE AT YOUR OWN RISK, TEST IT FIRST):

      cx-coupon-list is packaged and ready to upload via User Interface → Flex Components.

      To your core question: yes, and it's better than a manual toggle. Admins enter only the coupon codes; instance.mvt resolves each one server-side with Coupon_Load_Code() and mirrors the exact validity rules Runtime_Coupon_Load_Code applies at checkout — active, dt_start/dt_end, and use_count vs max_use. Expired and fully-claimed detection is authoritative, not admin-maintained, and a Page Builder setting chooses gray out with a status badge ("Expired" / "Fully Claimed") or hide completely.

      Everything you selected is in: live countdowns that flip a card to expired in-browser the second it lapses (server-relative offsets, so browser clock skew can't lie), click-to-copy code pills, "Only 8 left!" scarcity counters from live remaining uses, and unavailable-sorts-last. Plus a few things the use case implied: "Coming Soon" state for future-dated coupons that auto-activates when the start time passes, an optional age-out ("remove expired after N days"), and a configurable empty-state message.

      One scoping note: max_per and customer-scope restrictions are passed through but not evaluated — a public listing page can't know who's shopping, so per-customer limits belong in the fine-print field. Worth a human review pass before it goes on a production store, per policy.
      Also remove the .zip from the Flex Component so the file ends in .tar.bz2 which is what Miva expects, I had to alter it to post on the forums.

      Create a page with your header and footer, then use PageBuilder to add this Component to test it. Once you have it working the way you want voila.
      Attached Files
      Thanks,

      Rick Wilson
      CEO
      Miva, Inc.
      [email protected]
      https://www.miva.com

      Comment


        #4
        Rick Wilson Thanks for that.
        With some hand-holding from Claude I was able to upload that flex component you provided and added it to a page-builder page. It does look like it needs tweaking but that's way beyond my skills for now.
        pat
        http://lockitt.com

        Comment


          #5
          Ok here's a new version that I played with and got working. You can see it in action on one of my throwaway demo sites: www.milkbird.com it's on the homepage under the hero. Try deleting the original Flex Component and then installing this one and configuring it.
          Attached Files
          Thanks,

          Rick Wilson
          CEO
          Miva, Inc.
          [email protected]
          https://www.miva.com

          Comment


            #6
            Rick Wilson I did get it to work with that first Flex component. Coupon codes added to the Coupon List component in Page Builder, providing the coupon exists, show nicely on the live page with parameters like count and expiration date.
            An issue that popped up immediately is, what to do with coupons for logged in customers only? Testing a restricted coupon also showed on the public page.
            An option could perhaps be to make the entire coupon page viewable only to logged in customers. I did not see a clear way on how to do that.
            Adding coupons to the Coupon List component and page could benefit from having a list of the available coupons in Marketing>Coupons
            pat
            http://lockitt.com

            Comment

            Working...
            X