# Automatically complete free orders

**URL:** <https://community.hivepress.io/t/automatically-complete-free-orders/2472>\
**Category:** Marketplace\
**Tags:** marketplace\
**Created:** [October 21, 2022, 6:02pm UTC](https://community.hivepress.io/t/automatically-complete-free-orders/2472 "2022-10-21T18:02:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arielkbs](https://community.hivepress.io/user_avatar/community.hivepress.io/arielkbs/32/2085_2.png) [@arielkbs](https://community.hivepress.io/u/arielkbs)\
**Post date:** [October 21, 2022, 6:02pm UTC](https://community.hivepress.io/t/automatically-complete-free-orders/2472/1 "2022-10-21T18:02:25Z")

</div>

I would like to autocomplete $0.00 orders.

I created a free plan and every time someone signs up, the order keeps processing. In this case I would like to complete automatically, because it is $0.00.

---

<div class="post-metadata">

**Author:** ![yevhen](https://community.hivepress.io/user_avatar/community.hivepress.io/yevhen/32/23_2.png) [@yevhen](https://community.hivepress.io/u/yevhen)\
**Post date:** [October 23, 2022, 1:07pm UTC](https://community.hivepress.io/t/automatically-complete-free-orders/2472/4 "2022-10-23T13:07:44Z")

</div>

Please try this PHP snippet

```auto
add_action(
	'woocommerce_thankyou', 
	function($order_id) {
		// Get order.
		$order = wc_get_order( $order_id );

		if ( ! $order || ! $order->get_meta( 'hp_vendor' ) || floatval($order->get_total()) > 0) {
			return;
		}
		
		$order->update_status( 'completed' );
	},
	1000
);

```

---

<div class="post-metadata">

**Author:** ![system](https://community.hivepress.io/user_avatar/community.hivepress.io/system/32/13990_2.png) [@system](https://community.hivepress.io/u/system)\
**Post date:** [November 22, 2022, 1:08pm UTC](https://community.hivepress.io/t/automatically-complete-free-orders/2472/5 "2022-11-22T13:08:45Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
