Vendure: [admin-ui] not possible to create a promotion for the whole catalog if a facet is not selected

Created on 3 Jan 2020  路  7Comments  路  Source: vendure-ecommerce/vendure

Describe the bug
When you try to create a simple promotion (condition: orderTotal > 0) for the whole catalog (action discount products with these facets without specifying any facet), the button "CREATE" is disabled....until you add and then remove again a random facet.
So, i.e. it is actually possible to define a promotion -15% OFF for the products' whole catalog (no facet selected) as needed, but you need to select and unselect a random facet.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://demo.vendure.io/admin/marketing/promotions
  2. click "Create a new promotion"
  3. insert the promotion name
  4. Add condition => If order total is greater than 0
  5. Add action => Discount products with these facets by 15%

Expected behavior
after 5) I expect the "CREATE" button to be enabled, while it isn't.

By the way the button is enabled if:

  1. select a facet from the action box (i.e: category: Electronics)
  2. remove that facet from the action box
    => the button is enabled, you can create the promotion and it actually applies on all the products.
bug 馃悰

All 7 comments

If you want to discount the entire order by 15%, why not choose the "Discount order by { discount }%" action instead? That is the intended action for this use-case.

I would actually argue that the "Discount products with these facets" action should _enforce_ at least 1 facet to be selected. Thoughts?

Some considerations:

  • If you want to discount the whole catalog - not the order final price - you need a way to do it: it's just not the same, because order price will be applied at the end of the purchase flow, while in the storefront you want to see all the prices reduced when you set such a discount
  • BTW the action is not currently enforcing at least 1 facet to be selected because by selecting and removing the facet you actually can make it.
  • I personally would prefer to have the possibility not to specify a target facet and just leave that field empty to discount everything, and I suppose this is useful for other users too (I wouldn't have other easy ways to make it from the admin-ui app).

Is it possible to write custom promotion conditions and custom promotion actions ?
If so, please suggest how to do it.

@janumpallykalyan Yes it is. Currently there are no docs apart from the generated ones at https://www.vendure.io/docs/typescript-api/promotions/

I'm currently working on improvements to this area and will include some dedicated guides to writing them. For now, I suggest you study the default conditions and actions to get an idea how they are done.

@michaelbromley Thanks man. It's working fine.

@michaelbromley Like collectionFilters in CatalogOptions, Can I have orderFilters in OrderOptions ? Can You please gprovide insights on it how to write.. 鉁嶏笍 .

@janumpallykalyan I'm not sure what you mean exactly. Best place to ask something like this in in slack, then we can discuss and clarify what you mean.

Was this page helpful?
0 / 5 - 0 ratings