2

How should I retrieve a purchasable element criteria in Craft Commerce ?

To get entries, I just do

craft()->elements->getCriteria(ElementType::Entry);

I have tried the following without any success to get purchasables

craft()->elements->getCriteria(ElementType::Purchasable);
craft()->elements->getCriteria(ElementType::Purchasables);
craft()->elements->getCriteria(ElementType::Product);
3

By default, Commerce only provides 3 custom element types to Craft... products, orders and variants.

My guess is you're looking for products, in which case the syntax you're looking for is:

$productsCriteria = craft()->elements->getCriteria('Commerce_Product');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.