I'm looping through products (
$rawProduct) within Craft Commerce, within a plugin, and returning products which fulfill a certain criteria. I'm then returning a
$products array of objects with the following:
$product = new \stdClass; $product->url = $rawProduct->url; $product->courseTitle = $rawProduct->relatedFieldTitle['title']; $product->courseUrl = $rawProduct->relatedFieldTitle['url']; array_push($products, $product);
This is working great. However, when the target entry of the related field is disabled, lines three and four above are returning empty. I'd like to get this information no matter whether the target entry is disabled. Any ideas?