hey
Thanx you , i used your code as part of custom endpoint
unfortunately it returns an emty response
add_action( 'rest_api_init', function () {
register_rest_route( 'my_flexible_test', '/v1', array(
'methods' => 'GET',
'callback' => 'myfuncallback',
) );
} );
function myfuncallback($request){
return do_action(
'flexible_wishlist/init',
function ( $_, $wishlist_repository ) {
$user_id = 1;
$wishlist = $wishlist_repository->get_by_user( $user_id );
$wishlist_items = $wishlist->get_items();
$product_id = [];
foreach ( $wishlist_items as $wishlist_item ) {
$product_id[] = $wishlist_item->get_product_id();
}
return $product_id;
},
10,
2
);
}