#jacobjensen

1 messages ยท Page 1 of 1 (latest)

tired isleBOT
sudden scarab
#

๐Ÿ‘‹ happy to help

visual pawn
#

awesome - let me send you a screenshot of the issue

sudden scarab
#

would you mind sharing the invoice ID? in_xxx

visual pawn
#

in_1NNDfQE5RkzLDNUxUhKPofH1

#

so the coupon is only applicable to 1 of the 2 products, but the discount is displayed on every line, which is quite confusing

sudden scarab
#

taking a look

tired isleBOT
sudden scarab
#

the reason why the discount is shown on each invoice item, is because you're creating the invoice items one by one and passing the discount to each invoice item creation API

visual pawn
#

Yup, but is it possible to create the invoice in any other way via the API?

sudden scarab
#

yes

#

you can pass in the discount to the invoice

visual pawn
#

if i apply the discount to the invoice, then the discount is only applied once

sudden scarab
#

instead of passing it to each invoiceitem

visual pawn
#

yeah, but we want to the discount to be applied to every instance of the relevant product. so if we have 5 of the products, we would like for every one of those products to have the discount applied

sudden scarab
#

it will

visual pawn
#

1 minute

#

in_1NNDxpE5RkzLDNUxs3yiycDq

#

if you look at this invoice, you can see that it only applies the discount once.

sudden scarab
#

why aren't you using quantities though?

visual pawn
#

because we were experiencing the same problem. That despite the fact that a product was listed with 5 in quanitity, the discount was only applied once.

stoic hearth
#

This is working as expected from what I can tell. You've applied a fixed amount (โ‚ฌ400) at the invoice level. Therefore we reduce the invoice total by 400, not each line item. Can you help me understand what outcome you're expecting?

visual pawn
#

I was hoping to apply on a product level. So for the specific product I would like for the discount to be applied to every instance. So the above invoice should have -800 as the discount

#

I can succeed in doing this by applying the discount to the invoice item level, but then it adds the discount line to the irrelevant items, which makes it confusing

stoic hearth
visual pawn
#

alright - thank you

stoic hearth
#

Not sure if/how that'll work

#

i.e. 1x per line item

visual pawn
#

I tried this, and it worked with regards to amount. But the problem is that it adds a discount line to every item on the invocie. So it just ends up looking very confusing, though the final amount is correct

stoic hearth
#

Why not utilise quantities? That will concolidate the lines

visual pawn
#

well then the problem is that the discount is only applied once. But if the quantity is 7 for example, we would like the discount to be applied once for every instance of the product

#

so in this case, it should be 7*400 in terms of discount, and not just 7000

#

*700

stoic hearth
visual pawn
#

How can I add the coupon multiple times via the api?

stoic hearth
#

discounts accepts an array of objects, see above. As I said, I think this should work

visual pawn
#

Unfortunately, the same coupon cannot be applied multiple times

stoic hearth
#

Got it. Then maybe consider a % coupon, or creating an ad-hoc coupon that is the total of the amount you want to discount

#

So, โ‚ฌ2000 (?) in the example above

#

A few workarounds there for you to consider