Skip to content

Commit 00a8f11

Browse files
committed
fix prices
1 parent fbf3c33 commit 00a8f11

File tree

2 files changed

+32
-14
lines changed

2 files changed

+32
-14
lines changed

scripts/initializers/auth.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,8 @@ await initializeDropin(async () => {
1616
};
1717

1818
// Initialize auth
19-
return initializers.mountImmediately(initialize, { langDefinitions });
19+
return initializers.mountImmediately(initialize, {
20+
langDefinitions,
21+
adobeCommerceOptimizer: true // Enable ACO
22+
});
2023
})();

scripts/initializers/index.js

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@ const setAuthHeaders = (state) => {
1616
}
1717
};
1818

19-
const setCustomerGroupHeader = (customerGroupId) => {
20-
CS_FETCH_GRAPHQL.setFetchGraphQlHeader('Magento-Customer-Group', customerGroupId);
19+
// const setCustomerGroupHeader = (customerGroupId) => {
20+
// CS_FETCH_GRAPHQL.setFetchGraphQlHeader('Magento-Customer-Group', customerGroupId);
21+
// };
22+
23+
const setAdobeCommerceOptimizerHeader = (adobeCommerceOptimizer) => {
24+
if (adobeCommerceOptimizer?.priceBookId) {
25+
CS_FETCH_GRAPHQL.setFetchGraphQlHeader('AC-Price-Book-ID', adobeCommerceOptimizer.priceBookId);
26+
} else {
27+
CS_FETCH_GRAPHQL.removeFetchGraphQlHeader('AC-Price-Book-ID');
28+
}
2129
};
2230

2331
const persistCartDataInSession = (data) => {
@@ -45,7 +53,8 @@ const setupAemAssetsImageParams = () => {
4553
export default async function initializeDropins() {
4654
const init = async () => {
4755
// Set Customer-Group-ID header
48-
events.on('auth/group-uid', setCustomerGroupHeader, { eager: true });
56+
//events.on('auth/group-uid', setCustomerGroupHeader, { eager: true });
57+
events.on('auth/adobe-commerce-optimizer', setAdobeCommerceOptimizerHeader, { eager: true });
4958

5059
// Set auth headers on authenticated event
5160
events.on('authenticated', setAuthHeaders, { eager: true });
@@ -68,20 +77,26 @@ export default async function initializeDropins() {
6877
await fetchPlaceholders('placeholders/global.json');
6978

7079
// Initialize Global Drop-ins
80+
// NOTE: Adobe Commerce API sandbox only supports Catalog Service queries.
81+
// The following drop-ins require Core Magento GraphQL and are disabled:
82+
83+
// Disabled: requires Core Magento GraphQL (generateCustomerToken, etc.)
7184
await import('./auth.js');
7285

73-
await import('./personalization.js');
86+
// Disabled: requires Core Magento GraphQL (storeConfig query)
87+
// await import('./personalization.js');
7488

75-
import('./cart.js');
89+
// Disabled: requires Core Magento GraphQL (cart mutations)
90+
// import('./cart.js');
7691

77-
events.on('aem/lcp', async () => {
78-
// Recaptcha
79-
await import('@dropins/tools/recaptcha.js').then((recaptcha) => {
80-
recaptcha.setEndpoint(CORE_FETCH_GRAPHQL);
81-
recaptcha.enableLogger(true);
82-
return recaptcha.setConfig();
83-
});
84-
});
92+
// Disabled: requires Core Magento GraphQL (recaptchaV3Config)
93+
// events.on('aem/lcp', async () => {
94+
// await import('@dropins/tools/recaptcha.js').then((recaptcha) => {
95+
// recaptcha.setEndpoint(CORE_FETCH_GRAPHQL);
96+
// recaptcha.enableLogger(true);
97+
// return recaptcha.setConfig();
98+
// });
99+
// });
85100
};
86101

87102
// re-initialize on prerendering changes

0 commit comments

Comments
 (0)