Skip to main content

Timeline for Product related widgets in GraphQL

Current License: CC BY-SA 4.0

12 events
when toggle format what by license comment
Jul 6, 2022 at 7:37 answer added dotancohen timeline score: 0
Jul 6, 2022 at 6:44 comment added Adarsh Khatri It's a pretty standard query. I have added it anyway.
Jul 6, 2022 at 6:44 history edited Adarsh Khatri CC BY-SA 4.0
added 303 characters in body
Jul 6, 2022 at 6:41 comment added dotancohen I see what you're saying. Post your GraphQL query to the question. Thanks.
Jul 6, 2022 at 6:36 comment added Adarsh Khatri I can. I think I need to better explain it. CMS page can have content in it and a widget of recently added products. When GQL responses the content of this page, it will parse the output based on LUMA theme. Our business logic (show/hide price, add to cart button etc) are in GQL, not in LUMA theme. Because of this the HTML response is wrong. Yes, we can add the business logic in Luma Theme but that means it's redundant work (in GQL and in Luma Theme). Hope this makes sense.
Jul 6, 2022 at 6:30 comment added dotancohen Can you not request the SKU field via GraphQL?
Jul 6, 2022 at 6:29 history edited Adarsh Khatri CC BY-SA 4.0
added 7 characters in body
Jul 6, 2022 at 6:27 comment added Adarsh Khatri The output is correct, but this leads us to double work to implement business logic in two places, ie, GQL and the LUMA theme. I was hoping if someone has a better idea to deal with it. One of the ideas I have is to just output SKUS in place of HTML for those widgets and when NodeJS is rendering the JS, extract the SKUs and make another query and then replace that block of html.
S Jul 6, 2022 at 6:24 history suggested dotancohen
Add tag to clarify that this applies to Magento 2
Jul 6, 2022 at 6:21 review Suggested edits
S Jul 6, 2022 at 6:24
Jul 6, 2022 at 6:20 comment added dotancohen CMS page content with widgets is output as plain HTML In what format would you expect or prefer the output be?
Jul 6, 2022 at 0:43 history asked Adarsh Khatri CC BY-SA 4.0