vendure-ecommerce/vendure-plus-issues

Conditional gift card usage

PKarics opened this issue · 2 comments

In our aspect the gift card is a special promotion where the actual balance is tracked. Based on that idea we would like to set promotions like conditions on gift cards.

Examples:

  • gift card can be used for specific products, product variants, facetvalues
  • gift card cannot be used for specific products, product variants, facetvalues

Current gift card functionality should be the default behaviour.
If product specific conditions exist, then if all conditions are met for a specific product, then the gift card value can be used to this product. In case of multiple products int the cart the gift card balance should be decreased by the values of products where the gift card is usable.

Multiple gift card can be used during the payment process. (They can cause separated payment entities if it is easier. )

Examples (ignore taxes for simplicity):
1.
Gift card has 400 usd balance. It can be used only for product A which is 200 usd.

The cart has 1x product A and 1x product B (100 usd / piece).
Cart value is 300.

Payment:
Gift card payment can fulfill 200 usd. (only product A)
Gift card balance is 200 usd.
Credit card payment fulfill 100 usd.

Gift card A has 400 usd balance. It can be used only for product A which is 200 usd.
Gift card B has 500 usd balance. It cannot be used only for product A.

The cart has 1x product A and 1x product B (100 usd / piece).
Cart value is 300.
Gift card A payment can fulfill 200 usd. (only product A)
Gift card B payment can fulfill 100 usd. (for product B)

Thanks for the detailed write-up of your requirements.

Can you describe the intended workflow for gift card creation? I.e. I am trying to understand at what point we would assign these restrictions to a gift card.

My rough idea right now is to allow you to define a ConfigurableOperationDef-based object that is used to control the application of a gift card.

So we could have an array where you define all the available restrictions like

GiftCardPlugin.init({
  restrictions: [productVariantRestriction],
})

and then at some point we would need to assign this restriction to a particular gift card, i.e.

"apply the productVariantRestriction to this gift card, and set the allowedProductVariantIds array to [123, 234]"

I am also guessing you might need a way to indicate to the customer that such restrictions exist, so that they know ahead-of-time that the gift card can only be used on Product A and not Product B?

Your idea about the creation seems good and enough.

We would like to create a gift cards which is purchasable, so the restrictions should be attached to the template and displayed to the customers.

How can we avoid to purchase a gift card with a gift card? (Same or different type too)