How to forward Product data from product list to Product Detail page
Forward the product list, or your own data, from the product list page to the product detail page with onOpenProductDetail.
Pre-requisites
Update the version of the @appmaker-xyz/shopify package to 0.3.47-main-productlist-forward.0
Forward product list to Product Detail page
-
To forward the default product list data to the Product Detail page:
When opening product from PLP by calling hook method
onOpenProductDetail, include theforwardProductListkey astruein the method.Example:
onOpenProductDetail({forwardProductList = true}); -
If you have a custom product list implementation, you can pass the data using the
extraDatakey of the same method.
Example:
const extraData = [{item: 1}, {item: 2}];
onOpenProductDetail({ extraData });Receive product list data in Product Detail page
You can receive the product list data on the productDetail block.
Example:
const { extraData } = props?.currentAction?.params;
const { productsList } = props?.currentAction?.params;