WC_Order_Refund
-
Hello
I use this plugin : “PDF Invoices & Packing Slips Professional”
and get a problem with refunded orders, the developper sent me this answer :This looks like an issue specifically with the Flexible shipping plugin, which assumes an order is always a regular order, but WooCommerce has more types of orders an d in this case it’s the WC_Order_Refund. The PHP error tells exactly what the error is:
WPDesk_Flexible_Shipping_SaaS_Live_Rates_Fallback_Metadata_Handler::add_fallback_to_shipping_method_name() must be an instance of WC_Order, instance of WC_Order_Refund given
Breaking this down in human terms:
WPDesk_Flexible_Shipping_SaaS_Live_Rates_Fallback_Metadata_Handler has a method add_fallback_to_shipping_method_name that hooks into the filter woocommerce_order_shipping_method
This filter takes 2 arguments (source), the shipping method name ($names) and the order object ($order)
The shipping plugin has set this filter for WC_Order, but that’s not the only order type in WooCommerce that is filter is used for. For refunds, WooCommerce creates instances of WC_Order_Refund.Unfortunately this is not something we can fix from our end. But you can contact the developers of the Flexible shipping plugin with the above information, all they need to do is remove the type hint of the second argument (or type hint the abstract instead, WC_Abstract_Order), which inherits all order types.
Let us know if you need more information from us!
please help 🙂
The topic ‘WC_Order_Refund’ is closed to new replies.