Cannot expand cross_sells.product #27
Answered
by
alextutii
siphosenkosindhlovu
asked this question in
Help
-
I've been trying to make a product page with support for cross sells, but I can't to expand the |
Beta Was this translation helpful? Give feedback.
Answered by
alextutii
Dec 8, 2022
Replies: 1 comment 3 replies
-
Hi! The Frontend API (swell-js) does not support expansion of import swell from "swell-node";
export const getStaticProps = async ({ params }) => {
swell.init(STORE_ID, STORE_SECRET_KEY);
const product = await swell.get(`/products/${params.slug}`, {
expand: ["cross_sells.product"],
});
//...
}) |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
siphosenkosindhlovu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
The Frontend API (swell-js) does not support expansion of
cross_sells.product
. Since you're making the request on the server, you could use the Backend API instead here as it supports this expansion. Here's a snippet of how that would look like with swell-node library: