Alex Howes
Forum Replies Created
-
AuthorPosts
-
December 16, 2018 at 3:15 pm in reply to: WPInvoicing retrieves old pending invoices when user buys new item #2436
Hi Paulo,
This seems odd. Is it possible that by ‘cleaning up’ the pending invoices you might mistakenly delete the invoice of someone in the middle of a transaction?
Alex
December 1, 2018 at 9:46 pm in reply to: WPInvoicing retrieves old pending invoices when user buys new item #2376Hi Paulo,
Is there another solution to this issue? It is causing quite a problem on my site and also seems like a general problem. E.g. the plugin might retrieve a draft invoice from months ago when the item price might have been very different!
Alex
December 1, 2018 at 5:54 pm in reply to: WPInvoicing retrieves old pending invoices when user buys new item #2372Hi Patrik,
Sorry to be revisiting this issue after some time. I haven’t resolved it yet.
I think this is probably intended behaviour of the plugin. I have an item setup which a user can purchase. When they click to buy the item, the plugin creates an invoice. If they click away without purchasing the item the plugin saves that invoice to draft. Later on if the same user clicks to buy the item again, the plugin retrieves the drafted invoice rather than creating a new one. This means that any updates made to the item in the intervening time are not there (e.g. item title, price, etc.)
Is there a way to delete the invoice when a user clicks away, rather than saving it as a draft? That way the next time the user clicks to buy the item the plugin would create a new invoice.
Hope that’s clear,
AlexAha, I’ve found wpinv_get_users_invoices()
Should have looked harder the first time, sorry ๐
Great, thanks Patrik! ๐
Hi Kor,
For some reason the CSS is not coming through.
Alex
This reply has been marked as private.Hi Patrik,
I tried changing add_action() to add_filter() and also added a filter to hook to in the code but it didn’t work. The details changed within the function but on the wpi-checkout page they are unchanged. Perhaps it is being overwritten later on, or the wpi-checkout page is retrieving the item details from somewhere else?
Alex
Hi Patrik,
I’m having difficulty changing the item details for items processed through the wpinv buy shortcode. I’ve tried hooking onto wpinv_setup_invoice but when I set the item details there they don’t change anywhere else. E.g. the item name shown on the checkout page is unchanged. My code is below.
add_action('wpinv_setup_invoice','add_fields_to_invoice_setup',10,2); function add_fields_to_invoice_setup($this_invoice, $invoice_id) { $this_invoice->payment_meta['cart_details'][0]['name'] = 'Testing'; }
Is there a function called after setup_invoice that’s overwriting it?
Thanks,
AlexHi Patrik,
Thanks for your information. I’m happy with doing the customization myself, it’s just helpful to have a pointer as to the appropriate hooks I can use- it’s hard to know without being familiar with the code so I appreciate your help ๐
I see the hook from the wpinv_insert_invoice() function is an action. Is there a filter I can hook to instead? I want to change the details of the invoice items. Do you know what I could use for that?
It looks like wpinv_email_content is what I need for the email part. It looks like I can put a condition on the email type to prevent my code applying to all emails sent.
Thanks,
AlexThanks ๐
Thanks, that’d be good ๐
Let me explain a bit more clearly. What I need is:
1) I have a [wpinv-buy] shortcode on some of my posts. Is there an action or filter I can hook to that’s called after the “Buy” button is pressed but before the wpi-checkout page appears? (I’d like to edit the invoice items dynamically to include the post id of the post the shortcode is on).
2) An action or filter to hook to after payment is confirmed but before the client email is sent (so that I can dynamically edit the client email depending on the invoice item).
Looking forwards to hearing from you after the weekend ๐
Alex
-
AuthorPosts