Does anyone know the best way to get all unique product SKUs from all orders of the user who is currently logged in?
User email@example.com has placed 3 orders.
Order 1 contains SKUs: 0001, 0002 and 0003
Order 2 contains SKUs: 0002 and 0004
Order 3 contains SKUs: 0001, 0002 and 0005
I'm looking for the returned list of SKUs to be: 0001, 0002, 0003, 0004 and 0005.
The aim is to create a list of all the products they have ordered in one page along with the product thumbnail, name and a link to the product page.
You can write a simple query to fetch what is needed. Pull all the orders and their items on the basis of customer, group it by Product SKU. You'll get what is needed. You can use the same query and create a simple module to list or design the way you want your screen to look.
Can you share the query you wrote so we can improve it ?
There are just 3 simple steps to get what they want.
Step 1: Add new tab to My Account
Step 2: Create Block in your module
Step 3: Create template and get data from your Block
Please check here to see the specific code! Hope it can help!