wpovernight / woocommerce-pdf-invoices-packing-slips

Create, print & automatically email PDF invoices & packing slips for WooCommerce orders.
https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/
Other
99 stars 46 forks source link

Fix not removing documents meta when renew a subcription #751

Closed MohamadNateqi closed 5 months ago

MohamadNateqi commented 6 months ago

close #688

This is related to this ticket.

Issue description: The customer renewing their subscription. For some of the subscriptions, the renewed order showed that the invoice had been generated, but with the wrong invoice number (usually the parent order of the subscription).

It was discovered that the subscription post contained some meta data that was being copied to the renewed order, including the invoice number and date. The reason for this meta data being there is not clear, but we had a method developed to prevent such meta data from being copied to the renewed order, to prevent such issues.

However, we encountered a problem with this method as there was a typo in the hook name, which prevented it from working correctly. Additionally, the old deprecated hook used to send the $meta argument with a different data structure than the new hook, so it needs to be updated to be compatible with the new data structure.

The old deprecated hook had this data structure for the $meta argument:

array(..., array( "meta_key":"_wcpdf_invoice_number","meta_value":"158" ), ...)

And this is for the new hook:

array(..., "_wcpdf_invoice_number":"158", ...)
MohamadNateqi commented 5 months ago

Both customers confirmed their issue has been fixed with this change.