This code removes the same products from displaying when using 2 Product loops on the same page. In this case, we have a custom loop of products displaying before the single product and a related loop of products showing after the single product on the same page. The code removes any duplicates so only unique products are shown on the same page.
Click the following gallery to view the default loop on the left image which shows duplicate products and the image on the right, once the code is installed, which removes all products shown in the first loop from displaying in the 2nd loop.
Demo Video
On request
Installation
There’s only 1 step :
Copy & paste the PHP code ( excluding the opening PHP tag ) from the functions.php file to the end of your child themes functions file or custom functionality plugin.
You must be logged in to post a comment.