Commerce - How can I get the values of a category field from a plugin?
MyPlugin.php

$record = MyPluginRecord::model()-&gt;findByPk($user-&gt;id);

if ($record) {
    $field = $record-&gt;getAttributes(); // The plugin model.

    if ($lineItems) {
        foreach ($lineItems as $lineItem) {
            foreach ($lineItem-&gt;purchasable-&gt;product-&gt;myCategoryField as $category) {
                error_log($category-&gt;title); // My Category
            }
        }
    } else {
        // The cart is empty.
    }
} else {
    // Product not found in cart.
}