Categories
Woocommerce

How to show or hide ACF field based on Woocommerce order status

You may want to show different Advanced Custom Field group based on status of your Woocommerce order status. Here we discuss the steps you can take to achieve this easily. You should know two basic things before we get started.

Woocommerce Order status types :

Woocommerce orders are a custom post type and order status types are simply the post status types of post type order. For the default post type, the main post status types are “published”, “future”, “draft”, “pending”and “trash”.

But for Woocommerce order post type, the status types are the following : “Pending Payment”, “Processing”, “On hold”, “Completed”, “Cancelled”, “Refunded”, “Failed” and “Draft”.

Woocommerce Order Status Types

ACF feature to show or hide custom field group based on status type :

ACF location

If you edit your ACF field group, you will see Location section which allows you to set rules to show or hide your custom field group. We will use this feature to show or hide a field group from Woocommerce orders.

STEPS to show or hide ACF field based on Woocommerce order status

STEP 1 : Click on edit for your ACF field group and in the edit screen. go to Location section.

STEP 2 : Select Post Status under post from the first dropdown.

Select from Woocommerce Status Types

STEP 3: Select your desired Woocommerce order status from the last dropdown and click update.

That’s it, you are done. and now you will have your field group to show on the order edit screen based on your order status. 🙂

If you have any question please feel free to contact via the comment form below, i reply to all queries. You can also contact me via the contact page form.

By Murali Kumar

I am a Full Stack Web Developer with over 12 years of experience. I love WordPress & WooCommerce.

If you need help of a WordPress developer for your website, get in touch now!.

Follow me on Twitter : @geekz

Leave a Reply

Your email address will not be published.