Jump to content

Refund issue on Prestashop 16


Recommended Posts

Hello, I'm having trouble generating a partial refund for a product in an order from my prestashop 16 module.  For some reason it still keeps displaying the product as available for a partial refund but as you can see in the code I think I managed to create a refund.  Any ideas on where the issue might be?

                        $orderDetail->product_quantity_return = 1;
                        $orderDetail->product_quantity_refunded = 1;
                        $orderDetail->product_quantity = 1;
                        $orderDetail->update();

                        $list = [];
                        $list[] = $item;

                        $currency = new Currency($order->id_currency);
                        $orderSlip = new OrderSlip();
                        $orderSlip->id_customer = (int)$order->id_customer;
                        $orderSlip->id_order = (int)$order->id;
                        $orderSlip->amount = (float)(-$item['product_price']);
                        $orderSlip->shipping_cost = false;
                        $orderSlip->shipping_cost_amount = 0;
                        $orderSlip->conversion_rate = $currency->conversion_rate;
                        $orderSlip->total_products_tax_excl = 0;
                        $orderSlip->total_products_tax_incl = 0;
                        $orderSlip->total_shipping_tax_excl = 0;
                        $orderSlip->total_shipping_tax_incl = 0;
                        $orderSlip->partial = 1;
                        if ($orderSlip->add()) {
                            $orderSlip->addPartialSlipDetail($list);
                        }
                        
                        OrderSlip::create($order, $list, false, -$item['product_price'], true, false); 

 

image.png

Edited by teratux (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...