I have a Woocommerce store and I'm trying to add prefixes to the order number based on if the order contains a product within one of two different categories.
The two categories are Customs and Refurbished.
This code works perfectly if the order only contains a Custom or a Refurbished product, but the problem occurs when an order contains both a Custom and Refurbished product. This code will just apply the prefix of CPC- or REF- depending on whatever item is first in the order.
I want to make it so that if an order contains both of these categories, that the system defaults to adding the Custom prefix of CPC- but I can't figure out how to do that.
Below is my code, look for the
