Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Parse categories coming from the back-end as a json array #6358

Merged
merged 2 commits into from
May 3, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions assets/js/base/hocs/with-reviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,14 @@ const withReviews = ( OriginalComponent ) => {
offset: reviewsToSkip,
};

if ( categoryIds && categoryIds.length ) {
args.category_id = Array.isArray( categoryIds )
? categoryIds.join( ',' )
: categoryIds;
const categories = Array.isArray( categoryIds )
? categoryIds
: JSON.parse( categoryIds );

if ( categories && categories.length ) {
args.category_id = Array.isArray( categories )
albarin marked this conversation as resolved.
Show resolved Hide resolved
? categories.join( ',' )
: categories;
}

if ( productId ) {
Expand Down