Partial refund statut
-
Hi,
i need to assign a pertial refund statu to the order when the order is partially refunded, would you have any hook or snippet for that please ? thanks
-
Hi there!
I understand you’re looking for a way to automatically assign a “Partially Refunded” status to your WooCommerce orders.Unfortunately, WooCommerce itself doesn’t have a built-in “Partially Refunded” order status, nor does the WooCommerce Stripe Payment Gateway plugin natively trigger a specific status for partial refunds out-of-the-box.
To achieve what you’re looking for, you’ll need a custom code solution, If you need more in-depth support or want to consider professional assistance for customization, I can recommend WooExperts and Codeable.io as options for getting professional help. Alternatively, you can also ask your development questions in the WooCommerce Community Slack as custom code falls outside our usual scope of support.
Hi
Thanks i know that but my question is what of your hook can i use to test if its a full or a partial refund then change change the order statut ?
Hi @pipoulito,
Thanks for the clarification!
While WooCommerce doesn’t provide a specific hook that distinguishes between full and partial refunds directly, you can use the
woocommerce_order_refundedaction to detect when a refund occurs. From there, you can compare the total refunded amount to the original order total and decide whether to treat it as partial.Here’s a helpful guide that walks you through creating a custom order status and applying logic to update it:
🔗 https://www.cloudways.com/blog/create-woocommerce-custom-order-status/If you choose to implement this, a developer can help customize the logic so it updates the status only when the refunded amount is less than the original total.
thanks but why not using this directly ? https://wp-kama.com/plugin/woocommerce/hook/woocommerce_order_partially_refunded
Hi @pipoulito,
The link you provided doesn’t appear to be from the official WooCommerce documentation site, and I haven’t encountered it before—if it does exist, it’s likely unofficial. The closest relevant hooks I’m aware of are woocommerce_order_refunded, woocommerce_refund_created, and woocommerce_order_fully_refunded.
As for woocommerce_order_partially_refunded, there isn’t a native hook by that name. If you’d like to explore this further or get other’s contribution, I recommend starting a discussion on GitHub, reaching out through the WooCommerce Slack community, or consulting a developer, as this goes beyond the scope of our direct support.
hi , you right , BUT you can find it in official code reference : https://woocommerce.github.io/code-reference/hooks/hooks.html and is in
wc-order-functions.phpso i suppose i can uset it ? thanksHi @pipoulito,
Thank you for the clarification and for getting back.
The code you referred to is responsible for determining whether a refund is partial or full, but it doesn’t control or assign the order status itself.
Whether or not to use this hook depends entirely on your specific needs and how you want to manage your order workflow. In many cases, it can be useful, while in others you might choose a different approach.
The typical process involves three main steps:
- Registering a custom order status
- Adding that status to WooCommerce’s list of order statuses
- Using the woocommerce_order_partially_refunded hook to assign the custom status when a partial refund occurs
Please note that writing the actual code for each of these steps would require custom development, which falls outside the scope of our support. You may consider working with a developer for this.
If you’ve found the support helpful, I’d be truly grateful if you could take a moment to leave a positive review for the plugin here: https://wordpress.org/support/plugin/woocommerce-gateway-stripe/reviews/#new-post
Hi
yes you right, i can achieve easyly 1&2 with PHP, i suppose i can assign the order status when woocommerce_order_partially_refunded is triggered and so i have not to compare order total initital amount and refund amount, right?
Hi @pipoulito,
The logic you use ultimately depends on the flow you’re aiming for.
When using the woocommerce_order_partially_refunded hook, WooCommerce has already determined whether a refund is partial or full, so there’s no need to manually compare the original order total with the refunded amount.
That said, you still need to ensure that the hook is used correctly to apply your custom order status and that the custom status itself is properly registered and handled within your setup.
How everything works together will depend on how you structure your code and intended workflow. If the hook functions is totally dependent on how you use it and guiding you in that area is outside our support scope as mentioned earlier.
Hi,
as i just need to assign a custom order statut “partially_refunded” that i would have previously registered with php to an order , i suppose it is the hook do t that.
Hi @pipoulito,
I understand what you’re aiming to accomplish, which is why I shared the guidance earlier. However, determining the best way to implement it really depends on how your site is structured, how orders are handled, and the overall checkout flow. That’s why we’ve been recommending you consult a developer who can offer tailored advice based on your specific setup and goals.
As @mahfuzurwp mentioned, you can also seek help through the WooCommerce community Slack channel for more insight.
Thank you for your patience and understanding.
The topic ‘Partial refund statut’ is closed to new replies.