How to forward Product data from product list to Product Detail page
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 theforwardProductList
key astrue
in the method.Example:
onOpenProductDetail({forwardProductList = true});
If you have a custom product list implementation, you can pass the data using the
extraData
key 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;