This members-only tutorial provides the steps to display recently viewed products on single product pages when using WooCommerce in Oxygen.
We shall take the code from here and improve upon it by
changing the display order to the order in which products have been viewed
excluding the current product being viewed and
limiting the number of products to 4
Step 1
WooCommerce keeps track of what products have been viewed using the woocommerce_recently_viewed cookie.
If the Recent Viewed Products widget that comes with WooCommerce is not present on single product pages, this cookie will not be created and used.
But we can use the code given here to set this cookie up even this widget is not used.
Note: As with any cookie-based solution, this will not work reliably when caching is present. You may have to either turn off caching on single product pages or exclude the cookie from being cached.