0

i need to get the grid of few products or card.html for a single product. I tried to use below two codes, but grid is coming blank and card doesn't getting product details inside it. Can you please help me here?

window.stencilUtils.api.product.getById(177, { template: 'products/card' }, (err, response) => {
  console.log(response);
});
window.stencilUtils.api.product.getById(177, { template: 'products/grid' }, (err, response) => {
  console.log(response);
});

Thank you.

1 Answer 1

0

This could be approached with the {{#each}} Handlebars Helper as seen in the grid.html template: https://github.com/bigcommerce/cornerstone/blob/master/templates/components/products/grid.html

Consider the context of the grid.html template, it is called through product-listing.html which could have a different context than where this script is being called. The Product Card Model can be found on the Dev Center here as well: https://developer.bigcommerce.com/stencil-docs/reference-docs/common-objects#common-product-card-model

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.