Skip to content

Commit

Permalink
Merge branch 'order-and-account' of github.com:hlxsites/aem-boilerpla…
Browse files Browse the repository at this point in the history
…te-commerce into order-and-account
  • Loading branch information
Ferri0 committed Nov 7, 2024
2 parents 386868e + 1e0b101 commit ea85f3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
12 changes: 6 additions & 6 deletions blocks/product-details/product-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export default async function decorate(block) {
Actions: (ctx) => {
// Add to Cart Button
ctx.appendButton((next, state) => {
const adding = state.get('adding');
const adding = state.get('addingCart');
return {
text: adding
? next.dictionary.Custom.AddingToCart?.label
Expand All @@ -187,7 +187,7 @@ export default async function decorate(block) {
disabled: adding || !next.data?.inStock || !next.valid,
onClick: async () => {
try {
state.set('adding', true);
state.set('addingCart', true);
await addProductsToCart([{ ...next.values }]);
// reset any previous alerts if successful
inlineAlert?.remove();
Expand All @@ -209,25 +209,25 @@ export default async function decorate(block) {
block: 'center',
});
} finally {
state.set('adding', false);
state.set('addingCart', false);
}
},
};
});

ctx.appendButton((next, state) => {
const adding = state.get('adding');
const adding = state.get('addingWishlist');
return ({
disabled: adding,
icon: 'Heart',
variant: 'secondary',
onClick: async () => {
try {
state.set('adding', true);
state.set('addingWishlist', true);
const { addToWishlist } = await import('../../scripts/wishlist/api.js');
await addToWishlist(next.values.sku);
} finally {
state.set('adding', false);
state.set('addingWishlist', false);
}
},
});
Expand Down
3 changes: 0 additions & 3 deletions scripts/initializers/pdp.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ await initializeDropin(async () => {
const langDefinitions = {
default: {
...labels,
Custom: {
AddingToCart: { label: labels.pdpCustomAddingtocart },
},
},
};

Expand Down

0 comments on commit ea85f3a

Please sign in to comment.