lunar
lunar copied to clipboard
Feat - Discounts
This is an initial PR to get discounts started in the core...
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated |
---|---|---|---|
getcandy-2-docs | ✅ Ready (Inspect) | Visit Preview | Dec 13, 2022 at 1:48PM (UTC) |
lunar-docs | ✅ Ready (Inspect) | Visit Preview | Dec 13, 2022 at 1:48PM (UTC) |
I've had a quick look through this and it all looks promising so far. One use case that we would have would be setting an entire brand
or category
on discount... from what I'm seeing that would mean adding every purchasable in those brands, which could be unwieldy. Would it be an option to change how you work out what items the discount applies to, so that a developer can write some custom logic to determine that?
I've had a quick look through this and it all looks promising so far. One use case that we would have would be setting an entire
brand
orcategory
on discount... from what I'm seeing that would mean adding every purchasable in those brands, which could be unwieldy. Would it be an option to change how you work out what items the discount applies to, so that a developer can write some custom logic to determine that?
We did intend to allow Collections to be added also. As for Brands, I guess it could be possible, but we're just trying to get an MVP out there. You can make your own discount types if you need something specific.
Looks good, but I found a few issues/concerns.
- When saving a discount it flashes the notification but immediately refreshes the page.
- Errors at the top of the form are not clear when trying to save a discount.
Few points here.
- Why is the "Priority" input so big?
- We need an explanation of what "Priority" is. It's not obvious, especially for non-developers.
- It would be helpful to have a way to view the current priority list.
- "Stop" is misleading. It looks like it will stop the discount.
- The word "propagating" is confusing, it needs a non-developer explanation. Something like...
Checking this will prevent other discounts from being applied if the current discount criteria is matched.
The UI is a little wonky here. It looks like some classes are missing on the parent, possibly p-2 space-y-2
.
- Show which discounts are active based on the date.
- Add sorting for date and status (active/inactive/scheduled).
- I don't think "Stop" is needed.
Adding a "Select All" could be handy, especially if there are lots of collections/brands.
The active button is invisible.
More of a generic issue across the hub, but the error icon overlaps the spinners in the number input.
Feedback...
We want to split the edit screen into 3 sections. The general information, e.g. name, handle, discount type, etc. Then the conditions for the discount, and then finally the rewards. We should break it up into separate panes to indicate this, as it's quite a full-on form currently.
Coupons should be part of the generic conditions for a discount. A discount should either automatically apply or be applied by a matching coupon.
Discount types should be "Buy X Get Y" or "Discount".
Buy X Get Y
This is the typical BOGOF type promotion. You can state which products you need to buy to qualify, and state which products you can get for free. We need to update the Cart to list the available free products (I did something before on a previous PR we closed). The free products should be grouped by the qualifying discount so that customers can easily apply them to their cart. If a customer already has a qualifying product in their cart, then they get it for free. If they remove it or don't apply a free product, then they simply won't get it.
Discount
This gives a % off the cart if the conditions are met. It may only discount certain products in the cart, or all products in the cart. We currently allow for a fixed amount off, if we're doing that it will need to be multi-currency. We also need to be careful that fixed amounts don't make something too cheap, free or even a negative amount. I guess there is an onus on the store owner to ensure the logic is correct, but we certainly should never have a negative number.
Misc. Feedback
The "min. cart amount" field is far too wide and it should also default to "0". In fact, there are a LOT of very wide inputs, which makes it hard to see what is expected.
E.g.
There are no conditions for channels and customer groups, we'll need those.
Do we need to consider reporting on how many times a discount has been used?
hello , I found an error in this branch ... it happens when I perform a clean install
error: "Foreign key constraint is incorrectly formed"
explanation: the error happens because the "brand_discount" table asks for a primary key "brand_id" that does not yet exist
how I fixed: simply renamed the "brand_discount" migration to migrate after the "brands"
@glennjacobs I've pushed a bunch of updates to the UI. Hopefully you should be able to pull down without any issue, but if there are problems let me know. it's a WIP atm.
Generally a great improvement. Here are my thoughts...


I think inputs should always have default values where possible.

Collections are not grouped by "Collection Group", might get a little confusing.


@alecritson
the migration error still exists
but now because of the "discounts" table
to fix it I renamed the discounts migration 2022_11_18_100000_create_discounts_table.php
to 2022_06_16_100000_create_discounts_table.php
a suggestion....
I believe that when there are several registered brands or collections, it can end up creating a rather large scroll, making it difficult for the end user
make this
more like this:







Validation doesn't show what's missing/wrong. E.g. not adding any Qualifying Products.

Can it be
"Qualifying Products"
"Product Rewards"
?

Setting max uses and then unsetting it causes this error.



No validation error if no products are selected on a "Buy X Get Y" discount type.
Validation errors display in the Discount Type pane, but the menu on the right doesn't indicate this by showing the menu item in red.

No validation on "Percentage" or "Fixed Amount" inputs.

Can we use the titles
"Qualify Products" & "Product Rewards"
?
How about showing the discount type on the index datatable?