2

I've never had success using Craft 3 with Commerce 2 beta. I always get an error that ".find()" is not recognized, and ".all()" doesn't work either.

My latest attempt has given me this error:

Twig Runtime Error – Twig_Error_Runtime Calling unknown method: craft\commerce\services\Products::type()

The line in question is this one:

{% set silentItems = craft.commerce.products.type('silentAuctionItems').find() %}

If I delete

.type('silentAuctionItems').find()

the error doesn't come up, but I don't get any products displaying.

I've searched through the Commerce documentation, and I can't find anything about this problem.

Thanks for any help you can provide!

1
  • My mistake: I actually have Commerce 2 beta running on this installation. I installed Commerce through the Craft 3 plugin store. And it's still giving me the template errors. Commented Aug 6, 2018 at 18:53

2 Answers 2

1
craft.product.type(x).all()

Will do it, without commerce

2

I figured out the problem. It should be

{% set silentItems = craft.products.type('silentAuctionItems').all() %}

You don't put .commerce between craft and .products.

Thanks!

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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