Open aayla-secura opened 3 weeks ago
Well, I found a way to set an item price during checkout: using the filter hook getpaid_payment_form_submission_processed_item
and editing the form item's price there works as expected.
But I'll leave this open as I wonder whether the wpinv_get_item_price
should also have the same effect, or if not, what is its intended use case?
Not 100% if it's a bug or I'm doing it wrong.
Am I correct that if a developer wants to programmatically and dynamically change how much a user is charged for an item, they should add a filter hook for
wpinv_get_item_price
? As in:I'm doing this and seeing some strange behaviour.
Firstly, when I change the price using this filter hook to 0, to make the item free for some users, checkout fails with a vague error: "An error occured while processing your payment. Please try again." and nothing more is logger either.
Secondly, when I change the price to something above 0, even though the user is charged the custom amount I return from the filter hook, at least according to Stripe, the total amount of the invoice reflects the original price, which is confusing:
What is the correct way to set dynamic pricing server-side (i.e. not using "let customer name their price")? And how is the
wpinv_get_item_price
supposed to be used?