ACF: Update field value based on value of another field

I have some custom posts that lists cars, motorcycles and trucks.

The values in the ACF fileds are automaticaly populated and I cannot change them manually because they come from an external software.

In this CPT I have 2 ACF fields (both are text fields):

  1. one called “Categroy” that can be Cars, Motorcycle, Truck.

  2. Another one called “Service”, that can be a value from 1 to 9.

As you can see the “objects” can have different Categories but they maybe share the same “Service”.

For example:

Categroy = Car Service = 9

Category = Truck Service = 9

I would like to update the value of the ACF Field “Service” based on the value in “Category”.

For example:

if Category is “Car” and the Service is 9, then 9 should be udpated in “Rent”

if Categroy is “Truck” and Service is also 9, then 9 should be udpated in “Buy”

How can I achieve that?

Topic advanced-custom-fields Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.