Syns Posted January 17, 2017 Share Posted January 17, 2017 Hi All.. I allow order on out of stock product on my website, the problem is it's hard to refund customer who used Credit Card payment (the process), so I want to hide this credit card payment method if product stock is zero. Any idea? Thank you Link to comment Share on other sites More sharing options...
bellini13 Posted January 17, 2017 Share Posted January 17, 2017 I think you would have to edit the payment module, which would have a function hookpayment or hookdisplaypayment. in that function you would have to look at the carts contents, and then for each product check its stock. if a product does not have stock, then you would return false from that function, which would hide it. 1 Link to comment Share on other sites More sharing options...
Syns Posted January 18, 2017 Author Share Posted January 18, 2017 Can you please tell me how to do it? what code to put? Thank you Link to comment Share on other sites More sharing options...
bellini13 Posted January 18, 2017 Share Posted January 18, 2017 You would add the following in the payment modules hookpayment function. This uses a core prestashop function to check the cart contents quantity. It ignores any virtual products which would not typically have stock. if (!$this->context->cart->isAllProductsInStock(true)) return false; Link to comment Share on other sites More sharing options...
Syns Posted January 19, 2017 Author Share Posted January 19, 2017 Awesome, that's what I want. Thank you sir. I mark this thread as solved. Link to comment Share on other sites More sharing options...
seymon Posted May 27, 2020 Share Posted May 27, 2020 Hello, please do you know solution for Prestashop 1.7? It only works with Prestashop 1.6. Thank You Link to comment Share on other sites More sharing options...
Geoc112 Posted September 24, 2020 Share Posted September 24, 2020 Anyone found a solution that works on 1.7 ? Link to comment Share on other sites More sharing options...
Geoc112 Posted October 7, 2020 Share Posted October 7, 2020 This is the solution i found I edited my hookPaymentOptions function in the module to include this //Dezactivare plata cu cardul pentru produse cu stoc 0 $products = $this->context->cart->getProducts(); foreach($products as $product){ if($product['quantity_available'] == 0){ return; } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now