methods/set-product-ids.js

  1. import commonFilter from './../lib/common-filter'
  2. // handle filter by product IDs
  3. export default (self, productIds) => commonFilter(self, null, '_id', productIds)
  4. /**
  5. * @method
  6. * @name EcomSearch#setProductIds
  7. * @description Defines list of product IDs to match on next search request.
  8. *
  9. * @param {array<string>|null} productIds - List of product ObjectIDs (`_id`)
  10. * @returns {self}
  11. *
  12. * @example
  13. // Set filter by ID and run search request
  14. search.setProductIds([ '5c703c40c626be23430d5033' ]).fetch()
  15. * @example
  16. // Remove filter by product ID
  17. search.setProductIds(null)
  18. */