Skip to content

Instantly share code, notes, and snippets.

@doozy
Last active May 4, 2019 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doozy/8178b9788be2797a0dc082b6a198c73f to your computer and use it in GitHub Desktop.
Save doozy/8178b9788be2797a0dc082b6a198c73f to your computer and use it in GitHub Desktop.
Get wishlist products for default user wishlist or by ID or SHAREKEY
if ( ! function_exists( 'tinvwl_get_wishlist_products' ) ) {
/**
* Get wishlist products for default user wishlist or by ID or SHAREKEY
*
* @param int $wishlist_id by ID or SHAREKEY, 0 = default wishlist of current user
*
* @return array|bool
*/
function tinvwl_get_wishlist_products( $wishlist_id = 0 ) {
$wishlist = tinv_wishlist_get( $wishlist_id );
if ( empty( $wishlist ) ) {
return false;
}
$wlp = new TInvWL_Product( $wishlist );
$products = $wlp->get_wishlist();
if ( empty( $products ) ) {
return false;
}
return $products;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment