Skip to content

Commit

Permalink
Optimize add to cart and enable list view
Browse files Browse the repository at this point in the history
  • Loading branch information
herzog31 committed Feb 8, 2024
1 parent 7a74465 commit ebdf941
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions blocks/product-list-page/product-list-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ export default async function decorate(block) {
const widgetProd = '/scripts/widgets/search.js';
await loadScript(widgetProd);

const { cartApi } = await import('../../scripts/minicart/api.js');

const storeDetails = {
environmentId: await getConfigValue('commerce-environment-id'),
environmentType: 'testing',
environmentType: (await getConfigValue('commerce-environment-id')).includes('sandbox') ? 'testing' : '',
apiKey: await getConfigValue('commerce-x-api-key'),
websiteCode: await getConfigValue('commerce-website-code'),
storeCode: await getConfigValue('commerce-store-code'),
Expand All @@ -31,8 +29,12 @@ export default async function decorate(block) {
imageCarousel: false,
optimizeImages: true,
imageBaseWidth: 200,
listview: true,
displayMode: '', // "" for plp || "PAGE" for category/catalog
addToCart: cartApi.addToCart,
addToCart: async (...args) => {
const { cartApi } = await import('../../scripts/minicart/api.js');
return cartApi.addToCart(...args);
},
},
context: {
customerGroup: await getConfigValue('commerce-customer-group'),
Expand Down

0 comments on commit ebdf941

Please sign in to comment.