Is there any way to translate this:
{% set shopify = craft.shopify.getProductById({ id: entry.shopifyProduct, fields: 'variants, id' }) %}
to the Element API?
I've tried this, but obviously it doesn't work:
return [
'endpoints' => [
'api.json' => [
'elementType' => 'Entry',
'criteria' => [
'section' => product,
],
'transformer' => function (EntryModel $entry) {
$shopify = craft()->shopify->getProductById({id:$entry->shopifyProduct});
return [
'id' => $entry->id,
'title' => $entry->title,
'url' => $entry->url,
'shopifyId' => $entry->$shopify
];
},
]
]
];