Forum

Thread tagged as: Question, PayPal

Set Quantity in Stock to 0

How can I set a product in the Paypal shop to have 0 quantity in stock? If I set the quantity to 0 in the edit page and click save, it appears to update the quantity but then it reverts back to 0.

Stuart Christie

Stuart Christie 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

That sounds like what you want it to do. Are you trying to set it to something other than zero?

Hi Drew,

My apologies, I made a mistake in my question. Should have said that it reverts back to 1... it's been a long day...

Drew McLellan

Drew McLellan 2638 points
Perch Support

What happens if you clear the field completely?

The edit won't submit because it's a required field.

The Paypal IPN callback is also not deducting stock when the quantity of a product is 1.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you turn on debug and let me know what it outputs when the problem occurs?

Hi Drew,

I've enabled debug. To test, I changed the product quantity from 1 to 0 and hit Save. It appears to work as in the green bar comes up to say it was successful and the quantity does appear to change to 0 but if I navigate away from the page and then go back to edit the product it is back to 1.

Which part of the output do you want me to show? There's quite alot.

Thanks for your help so far.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you get any red errors in the debug?

Nope - no red errors in the log.

I've managed to work around this by commenting out the following line in edit.pre for the PayPal Shop.

$Form->require_field('productCount', 'Required');

It now accepts a 0 but I'm not sure why/how this could cause the problem.

IPN callbacks still do not update stock levels when the quantity is 1 :(

Confirmed that IPN updates stock if the level is greater than 1

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, that sounds like a bug then. I'll log it.

Hi Drew,

Is there anything I can do in the meantime to fix this in my site? It's a bit of an issue as most of the products stocked are 1 offs and I can't guarantee that I'm able to manually deduct stock before another order is placed for the same item.

Stuart

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you getting any errors with the IPN script?

Where should I check? This is the what is output to the shop log table:

mc_gross=0.01&protection_eligibility=Eligible&address_status=confirmed&item_number1=12345TEST%2C+Shipping%3A+%C2%A30&payer_id=6G32MR4MPS6WY&tax=0.00&address_street=17+Fraser+Avenue&payment_date=13%3A33%3A36+Sep+22%2C+2014+PDT&payment_status=Completed&charset=windows-1252&address_zip=IV304EX&mc_shipping=0.00&mc_handling=0.00&first_name=Stuart&mc_fee=0.01&address_country_code=GB&address_name=Stuart+Christie+Web+Design&notify_version=3.8&custom=&payer_status=unverified&business=buckiemodelcentre%40gmail.com&address_country=United+Kingdom&num_cart_items=1&mc_handling1=0.00&address_city=Elgin&verify_sign=AB8uKJ-cgis5XVZJfu8yXdO6dhrpA3yydK0h6Qi0d5aP5n4x-TIf5I3J&payer_email=stuart.christie%40outlook.com&mc_shipping1=0.00&tax1=0.00&txn_id=09B05013XJ8569910&payment_type=instant&payer_business_name=Stuart+Christie+Web+Design&last_name=Christie&address_state=Moray&item_name1=Test+Product&receiver_email=buckiemodelcentre%40gmail.com&payment_fee=&shipping_discount=0.00&quantity1=1&insurance_amount=0.00&receiver_id=GLU3Y2CFMX3BA&txn_type=cart&discount=0.00&mc_gross_1=0.01&mc_currency=GBP&residence_country=GB&shipping_method=Default&transaction_subject=&payment_gross=&ipn_track_id=1584a9af74dd4

Drew McLellan

Drew McLellan 2638 points
Perch Support

Anything in your PHP error log, for example?

Hi Drew,

After some further troubleshooting I've got to the bottom of the IPN issue. The item numbers being sent to PayPal were incorrect therefore it was failing when it was calling back to update the stock.

There does still appear to be an issue with setting stock to 0 manually but as mentioned above, removing it as a required field is a suitable work around.

Thanks for the support.

Stuart