Woocommerce - add hook for "restock_refunded_item" to export a value by WP All Export
Budget: €30 – €250 EUR
The job is about exporting orders via XML table with WP All Export. This can be achieved most easily via a PHP function directly in the WP All Export plugin or via an additional hook.
The goal is to configure the table correctly for the ERP system. To do this, the three order statuses must be entered correctly in the export table:
S = Sale
R = Return
M = Return without restock
So when the sale is completed, then in a column/cell of the table of WP All Export Orders an "S" should be output.
If one or more product(s) per order are returned and come back to inventory, then an "R" should be output.
If one or more product(s) are returned per order and are NOT returned to inventory, then an "M" should be output.
On screenshot_1 you can see how to select if a restock should be done or not. I have already asked WP All Import support and they wrote me the following solution:
-----
Unfortunately, there is no straightforward way to get this value as this value is not stored as a post meta for the order.
To get this value, you'd need to hook into one of these:
do_action( 'woocommerce_restock_refunded_item', $product->get_id(), $old_stock, $new_stock, $order, $product );
Or this:
if ( ! apply_filters( 'woocommerce_can_restock_refunded_items', true, $order, $refunded_line_items ) ) {
return;
}
And save your own custom itemmeta to retrieve during the export.
-----
In one sentence:
Change/add something to the present hooks of woocommerce that I could export the three different statuses by WP All Export in a XML file export.
Please apply for the job only if you have read everything, understood and know how to solve my job. With the explanation to hook into one of these it should not be a big problem for an expert to find a quick solution.
The goal is to configure the table correctly for the ERP system. To do this, the three order statuses must be entered correctly in the export table:
S = Sale
R = Return
M = Return without restock
So when the sale is completed, then in a column/cell of the table of WP All Export Orders an "S" should be output.
If one or more product(s) per order are returned and come back to inventory, then an "R" should be output.
If one or more product(s) are returned per order and are NOT returned to inventory, then an "M" should be output.
On screenshot_1 you can see how to select if a restock should be done or not. I have already asked WP All Import support and they wrote me the following solution:
-----
Unfortunately, there is no straightforward way to get this value as this value is not stored as a post meta for the order.
To get this value, you'd need to hook into one of these:
do_action( 'woocommerce_restock_refunded_item', $product->get_id(), $old_stock, $new_stock, $order, $product );
Or this:
if ( ! apply_filters( 'woocommerce_can_restock_refunded_items', true, $order, $refunded_line_items ) ) {
return;
}
And save your own custom itemmeta to retrieve during the export.
-----
In one sentence:
Change/add something to the present hooks of woocommerce that I could export the three different statuses by WP All Export in a XML file export.
Please apply for the job only if you have read everything, understood and know how to solve my job. With the explanation to hook into one of these it should not be a big problem for an expert to find a quick solution.