Problem with reducing the package limit (+solution)

There is a problem with the correct counting of package,

previously described in

When a user buys a package for 1 listing, then adds a listing, the package properly disappears.

However, when the order for listing is validated/completed by admin, the user receives the package again and thus may add the free listing incorrectly, without paying for it.

There is a bug in the file
\plugins\hivepress-paid-listings\includes\components\class-listing-package.php

there is

if ( in_array( $new_status, [ ‘processing’, ‘completed’ ], true ) ) {

I think it should be with !

if ( ! in_array( $new_status, [ ‘processing’, ‘completed’ ], true ) ) {

This seems to be working correctly now.

Please check and update.

Hi,

Thanks for reporting this, the bug is already confirmed, and we’ll fix it as soon as possible.

OK, anyway paid-listings users can use this solution as a temporary fix.

1 Like

I’ve tested this solution, but it doesn’t work fully. Packages are calculated correctly, but listing is also added if the payment is not completed.
I propose another change that works for me:

in file
\plugins\hivepress-paid-listings\includes\components\class-listing-package.php

there is

if ( in_array( $new_status, [ ‘processing’, ‘completed’ ], true ) ) {

Changed to:

if ( in_array( $new_status, [ ‘processing’ ], true ) ) {

( without ‘completed’ - when the order status is changed to “completed” )

I only have instant payments and I always get the “processing” status after a successful payment. When I change the status of the order to “completed” then nothing happens, no additional package for the user is added.
For me this solves the problem of packets, so far I do not see the error of this solution.

Thank you for the details. We will check this issue as soon as possible

Sorry for the confusion. It seems like it works correctly as Processing or Completed order statuses mean that payment for the order was successful so it is correct if listings become published when the order has these statuses

Hello

The problem is that if the User buys a package for one listing. After payment, the order status changes to processing. User gets package for one listing. Listing is published. The package is reset. So far it works OK.

Now me/admin changes the order status to Completed manually.

Then the User receives a free package for one listing, which should NOT happen!!!

In the code it is after changing the order status to Processing or Completed to add a package, this is probably the problem.

So in my case removing Completed helped as I described above.
See the beginning of the thread - others are reporting the same problem.

Thank you for the details, the bug is confirmed, and we’ll fix it as soon as possible.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.