The below code looks for categories in the products directory. How can I change this code to first look in products/categories and if null, look in shop/categories. 

I need this to work in products/categories as well as shop/categories.

The code below works great on a WooCommerce website. However when the Dokan Plugin is installed, Dokan redirects product/categories to shop/categories. 

Can anyone point me in the right direction?

```
echo json_encode($response);

} elseif ($tag == 'viewCategoryList') {

    try {

       echo json_encode($woocommerce->get('products/categories'));

    } catch (Exception $e) {

        $response["error"] = 1;

        $response["success"] = 0;

        $response["message"] = "Invalid Product Id";

        echo json_encode($response);
    }

```