useSavedProductsActions
The useSavedProductsActions hook provides mutation functions to save and unsave products (favorites). Returns saveProduct() and unsaveProduct() functions that accept product IDs and variant information. Saving a product adds it to the user's products collection in the Shop app. Use with useSavedProducts() to display current saved status and implement optimistic UI updates.
Caution
This hook requires adding the following scopes to the manifest file:
product_list:write
For more details, see manifest.json.
Caution:
This hook requires adding the following scopes to the manifest file:
product_list:write
For more details, see manifest.json.
Anchor to useSavedProductsActionsuse Saved Products Actions()
use Saved Products Actions()
UseSavedProductsActionsReturnsUseSavedProductsActionsReturns
UseSavedProductsActionsReturns
- saveProduct
Save a product.
(params: FavoriteParams) => Promise<void> - unsaveProduct
Unsave a product.
(params: UnfavoriteParams) => Promise<void>
FavoriteParams
- productId
string - productVariantId
string - shopId
string
UnfavoriteParams
- productId
string - productVariantId
string - shopId
string
Was this page helpful?