craftcms / shopify

Synchronize and extend product data from your Shopify storefront.
MIT License
45 stars 25 forks source link

Calling unknown method: craft\shopify\elements\db\ProductQuery::publishedScope() #65

Closed johndwells closed 1 year ago

johndwells commented 1 year ago

Description

We are trying to query products with a publishedScope of web, and have followed the documentation as follows:

{% set webProducts = craft.shopifyProducts
  .publishedScope('web')
  .all() %}

However this results in the Twig Runtime error:

Calling unknown method: craft\shopify\elements\db\ProductQuery::publishedScope()

Delving into ProductQuery.php, we can see that indeed there is no code to set publishedScope on the query.

Additional info

lukeholder commented 1 year ago

Thanks for following up.

This has been fixed for the next release.

To get the fix early, change your craftcms/shopify requirement in composer.json to:

"require": {
  "craftcms/shopify": "dev-develop#411c7cbe343d7c5e16e937615c22c522c24989c5 as 3.1.1",
  "...": "..."
}

Then run composer update.

Thanks

lukeholder commented 1 year ago

This is now out in 3.2.0!

See the notes in the upgrading section of the README