Come on all gather around for a startup rugs to riches to rugs story. It was October of 2017, probably a rainy day or not I cannot recall. My investing itches started coming to life, I was a young software engineer one year after my first normal monthly salary job, before that I had finished my military service and previously I was under freelance contracts.
I had gathered my 3-6 months emergency fund, I had no clue back then it was called that, and I was ready to unleash my internal investor to make me money for my future. I started looking around for opportunities and what a European / Greek investor can do with limited funds. And of course I landed on a startup crowdfunding platform, my first investment was to a Dutch Electric scooter company with a scooter design named “Appscooter” yes silly name they were riding the mobile apps wave then, pun intended. The scooter would feature a smartphone screen with various things and it would be electric with interchangeable batteries. The smart screen didn’t appeal to me but the electric part always fascinated me.

At that time Tesla had only released the Roadster and Model S, while the Model 3 that exploded the company were starting to roll out of from the Fremont factory in California. I am not aware if Tesla was on my radar back then but for sure I always believed that Internal Combustion Engines (ICE) would soon come to an end.

Long story short I found the crowdfunding in Seedrs about this company and invested about half of my then monthly salary, I believed that it could be done and of course I was right. It was done by another company though. Last year I saw a documentary about a Taiwanese company that was actually producing electric scooters with interchangeable batteries and also it has a battery swapping network for charging them up. Its name is Gogoro, better than appscooter of course. At that point I became certain to me that my investment was lost, and I was right again. The best thing that Appscooter had done until then was rebranding to Etergo…. Anyway time passed by and my startup investing dream was a thing of the past. Etergo raised some more millions in funding in an increased valuation but still needed more cash to burn through like a fuel hungry Ford Mustang.

From the start of the year Etergo was still raising money either from convertible notes or various investors but it still needed more money with ZERO scooters out of the production line. Sidenote: ZERO is an actual company producing electric motorcycles also in California.
So at end of May the news broke, the company was sold off for scraps comparing to its “Valuation” to Ola electric an Indian company. I was happy. It would return to me 1/10 of my investment that’s better than 0, I had written of my books that investement entirely. The money were returned immediately and then I send them to Revolut and bought one gram of Gold from the new commodities feature that is now available to everyone. That was the gold lining of the story, pun also intended but it would be more fitting if silver was also available for investing via Revolut though.

Stock Portfolio Update May 2020

I continued my investment strategy of buying 3 new stocks every month for long term holding. I must admit that I also opened short term positions on EventBrite, Ebraer and Under Armour against my own advice see previous post. The first two did not provide anything more than the fees charged by Revolut. Under Armour (UA) would return to me more than 22% but Revolut glitched out yesterday and never carried out the Sell order and of course after that (UA) lost immediately 5%.

Below you can see my open positions, in June I will reach my long term position companies goal and from then own I will start increasing my investments in the already existing ones.

Every portfolio is personalized and should be tailored for every individuals needs and investing timeline. When someone is near retirement the portfolio should include zero risk assets. On the other hand when someone is starting investing more risk can be taken on. As I have discussed previously the first investment you should have is a 3 to 6 months of expenses saved up and ready on hand. This money will be useful in situations like the one we currently live on. Medical expenses, emergency home repairs and even daily expenses in case of job loss is what that this money is for. If you are certain that the above are covered then we can move on. If not maybe it is a good time to start liquidating any winning investments to create your emergency fund, if your job seems insecure gather up to 12 months as instructed by some advisors, while minimizing your expenses, something rather easy at the time being.

So what should we to do to protect our diversified portfolio? Nothing.
At these times the best thing is to do nothing at all. No buying because a stock seems cheap, no selling because your stocks trade at a loss and no re-balancing for “safer” investment. No buying gold through Revolut. Nothing! The chances are you will not beat the market with any genius move. We are here for the long run. We have planned ahead our roadmap and portfolio allocation percentages and we will stick to it. In my case the majority of my portfolio will be allocated in stocks eventually. And I will continue buying but currently I am pushing back the dates of my monthly buys. One thing although I am trying to do is hedge against the Euro so when the EUR is high against the USD I will be buying. It seems currently that the USD look like a safe haven for the rest of the world so it is becoming more expensive to own, but do not be fooled, the US economy has not been hit yet hard. Towards the end of my free trades of the month from Revolut I will be deploying those collected USDs to the stock market. In my opinion and from what I researched from articles, news etc the bottom is not here yet. So more losses could be coming and I will be probably conservative in my next purchases taking into account that the US are becoming a virus hotspot and the effects are not clear yet there. The statistics from China and Italy-Spain shows that things will get a lot worse before it stabilize and this will take weeks as we are still seeing exponential growth. And unfortunately USA is still on the beginning of that road. Any news about financial bazookas and armor piercing economic decisions are premature until we see the whole story unfold.

Keep safe and healthy.

So February has been a great month so far regarding my portfolio. From now on I will be tracking only my investments on stocks, microloans and cryptocurrency, as these are the only ones I can track accurately. They represent 2/3 of my total investments and I will continue investing in them exclusively. Stocks will be the primary, microloans the secondary and cryptocurrency investing will be halted as it still represents a great percentage of my invested capital.

So back to my portfolios’ progress, to date by taking account of the aforementioned asset classes my portfolio has increased by 7%, yes I know not a great return for 2 years of investing starting from 1/1/2018, my first ever crypto purchase. But cryptocurrencies are extremely volatile and to date the value has decreased by 10% on my portfolio. This is the main reason why I cannot consider them a safe asset and will limit them in the future to max 10% of my invested portfolio (currently 40% of my invested amount).

Here you can see my total invested portfolio, in the following months I try to divert all capital from other platforms to stocks and Mintos.

And on here are my investments in assets that I will be tracking from now on.

And here is the percentages based on their current value.

As you can see the stocks have outperformed my crypto assets. According to Yahoo Finance my stock portfolio has increased by 21.5% since September. So what went wrong during these 2 years?

The answer to that is probably FOMO (Fear of missing out) I started investing in crypto rather late to the party when the price of Bitcoin(BTC) was about 12.800€ and Ethereum(ETH) about 750€ and this was after the top of 20.000$ for Bitcoin in the end of 2017, as the cryptos continue to fall I continued investing and cost averaging in order to reduce the Break-Even price, it worked for Bitcoin but not yet for Ethereum(ETH) and Litecoin(LTC). My last investment in crypto was in early September of 2019, one whole year after the previous. In late September of 2019 I started the journey of stock investing and here we are now.

Coming back to FOMO in the previous weeks I felt its presence again but on the other side of it. I have invested in Tesla(TSLA) in October 2019 with a price of 316$, with a rather modest position as I was starting out on this endeavor. At the time of writing Tesla has a price of 800$ a whooping 150% gain on my investment. One day before Tesla(TSLA) hit its all time high of 968$ on 04/02/2020 two of my best friends that just started with theirs first stock investments in the one week before opened a position in Tesla with a price of 721$ and 748$ accordingly. The next day they were extremely happy that they made 10% in a single day so they decided to buy again with a price of 856$ and 889$, after that Tesla (TSLA) skyrocketed to 968$ until long investors started profit taking to lower their risk, and short investors bought to minimize their losses. My friends ended with mean prices of 775$ and 844$, having a 3% gain and -5% respectively at time of writing. What they experienced the 2nd day of course was FOMO that’s why they increased their position and I cannot blame them as I know the feeling from when I first got into crypto, I even got tempted to increase my position also. Just for the history one of them got earlier than me on crypto, before the peak – summer of 2017, and so the roles were reversed now. One positive aspect is that before buying into Tesla they already had acquired one round of other companies so their portfolio balance is not only swinged by it, although they have a lot larger positive or negative swings depending if Tesla is rising or falling.

One aspect I personally want to explore is how well my portfolio performs against the indexes S&P 500, Dow 30 and Nasdaq. So I am currently researching on how this can be done.

I hope that the new Year found all of you well and healthy. It is the flu season after all. Now let’s get down to investing, on December and on January I increased my investments in Mintos and US stocks using Revolut. These investments amount in about one of my monthly wage. One of the advantages of getting an extra month’s of pay on Christmas in Greece is that if you stick to your budget including gifts and holidays you can save the rest and invest them, and this is exactly what I did.

On Mid December I invested in the following stocks Alphabet(GOOGL), Mastercard(MA) and PayPal(PYPL). Since then they have gone up between 7-9% pretty good for holding them only one month. This week I added to my stock portfolio Apple(AAPL), General Mills(GIS) and Nike(NKE), also in the green with about 1% increase. The US stock market is pumped and it might seem a little scary for a newcomer.

The thing that reassures me is that in a case of a stock market crash I will be buying with a discount, as I will be implementing the cost averaging technique. My strategy is to invest steadily for at least till my early 50’s and it is certain that there will be recessions and growth periods in these 2 decades(currently I am in my early 30’s), so making quick gains is not part of this strategy. All the companies I am investing are companies that have valuable products and services. Furthermore I am here for the long run, at least 20 years, by then I hope I have saved enough for me to not need to work anymore. Not that I will not want to work, but I will have the financial independence and will not need to wait the prime age of 67-70 to take my pension to be able stop work. I believe that this will give me the freedom to live in my own terms, even when I probably will not have the ability to change jobs and hunt opportunities as I currently have.

Back to my stock portfolio now since it’s inception it has grown by 12%, it is up to par with the rest of the market. It is a good time to be in the stock market just for the enjoyment that you get when you see your portfolio’s value increase.
Here you can see the actual growth of them.

Furthermore for my other investment types, Mintos is performing steadily with about 11%, they also introduces an Android app which is still in beta. When and if any of the other investment from other platforms finish I will redirect that capital to Mintos, I already started doing this as the rest of the platforms do not provide the same returns.
Lastly I am reviewing a new P2P lending platform IBAN Wallet. It seems that it has potentials for some specific cases, but I will write a full review in the near future.

As I wrote in my previous post I use Mintos for investing in MicroLoans. My strategy for investing with Mintos is in loans from issuers in European Union with buyback guarantee. The EU part due to stricter regulations for lending businesses and the second in order to make sure that if for 2 months the loan is not paid back the issuer of the loan will pay the capital and interest accrued and buy back the loan.

Now let’s start with a tutorial style how to. I am skipping the part of registration and topping up the account with your first amount to invest. Only a tip for topping up you can use Revolut to send a SEPA transfer to the Mintos IBAN without any fees, do not forget to add your investor ID as a comment.

Let’s follow this steps,

1) Click on Invest –  Auto Invest, on a PC it’s two steps, first click Invest and on the next page click Primary Market. The Invest & Access page is pretty much useless, I will explain later.

2) Click on Create new Auto Invest Strategy
3) Click on Custom Strategy
4) On the next screen we want Issuers only from EU countries,with Buyback guarantee and in Euro, select from the Currency Dropdown.  So from the dropdown on Buyback Guarantee uncheck No.

 5) From the Country dropdown uncheck non EU countries.After unchecking a bunch of boxes it will look something like this

Yes no UK due to brexit.
6) Set the Interest Rate to 10.5%.
7) Fill in the Strategy Name
8) Fill in the Portfolio Size it should be a little larger than your deposited amount to take into account future growth.
9)  Fill in Investment in one Loan I usually set 10€-20€
10) Change the toggle to No for Diversify across loan originators
11) Check the checkbox I accept the terms of Assignment Agreements
12) Click on Show matching Loans, a number should appear and the graphs should be updated

13) If everything seems OK click Save and Activate
After this the Auto Invest functionality will kick in and start investing.

The second auto Invest strategy is for Secondary transactions. So from the Auto Invest page 

1) Click Create New Auto Invest strategy
2) Click on Custom Strategy
3)Click Secondary from the Market Radio button
4)On the next screen we want Issuers only from EU countries,with Buyback guarantee and in Euro, select from the Currency Dropdown.  So from the dropdown on Buyback Guarantee uncheck No.
 5)From the Country drop down uncheck non-EU countries.After unchecking a bunch of boxes it will look something like this.

6) On Interest Rate set 10%
7) On Discount/Premium leave it as is.
8) Remaining Loan Terms set 0m to 6m
9) Add a Strategy Name
10) Set A Portfolio size it should be smaller than you main
11) In Investment in One Loan set 1 – 9.99€
12) Select No on the Diversify across loan originators 
13) Check the I accept the terms of Assignment Agreements checkbox
14) Click on Show matching Loans, a number should appear and the graphs should be updated.

14) If everything seems OK click Save and Activate

All set now. From now own any funds available on your account will be automatically invested.

So sit back and let your account grow. I would suggest to check back every now and then to check that the auto invest strategies are working, in case the loan rates have fallen or something like that.

I have being using Mintos for almost 2 years now and my account is growing with a 12% Net Annual Return. I intent to continue using it and increasing my position my goal is to be my 30% of my investments excluding cash. I would like to have my portfolio to a 60-30-10 ratio, where 60% is stocks, 30% is loans and 10% other investments.
My current portfolio value is shown here

So it seems I have a lot more to study for stocks. As the microloans are on track for the 30%.

As I shared with my previous post about investing I am currently using Revolut as it is the only way to get direct access to the US’s Stock Exchanges. The Revolut app has 450 U.S. stocks available from NYSE and NASDAQ.

As I posted previously Revolut offers 3 free trades per month in the free tier, furthermore 8 for Premium and unlimited trades for Metal tier subscribers. For my personal investment strategy the 3 free trades,commission free, seem currently adequate. At the end of each month, during week days I exchange EUR to USD and top-up my investment account, then I split this amount between my 3 monthly picks. If you want more than 3 trades per month then a flat fee of 1€ per order applies.

Currently I have invested 3 times in 9 different companies and my main aim is to reach 36 different stocks. The stocks I have selected are Blue Chip companies with huge valuations and very reputable. As I mentioned in my previous post you can buy and sell fractional shares, meaning you can buy 0.001 stock of Google, through Revolut, from as little as $1 up to $1000 per order. My first picks and the next that I have planned for the future are inspired from Vanguard’s U.S. Growth, a large growth and value based index fund. Of course this fund has 272 different stocks, I will be fortunate if I have 10% of that number in the next years. For researching stock opportunities I have used a lot of different websites for reading and comparing metrics. Some of them are yes Yahoo is still around, the webull app (it is a trading app,of course trading is not available in Europe, but it has a cool paper trading feature and various information) and
After my stock portfolio reaches 36 different stocks, Phase 2 will come into play. At that time I will focus on increasing my position in the top performing or most promising of those 36 stocks. As this is something far down the road, I will probably also re-balance under-performing stocks, if I get the chance.

Here you can see my first 9 stocks. Six of them have greater percentage because I decided to increase my monthly investment amount, after my first round.

And here is the current value for each of them. The value has increased by 8% .

As you see AMD,Disney and Tesla performed really well and I was really lucky picking them early,as they have grown greatly this year. On the other hand Netflix stock is falling, probably thanks to Disney+.

Currently EUR/USD pair is trading around 1,10-1,11 USD, one benefit of investing in USD is that if the rate changes you still benefit. Higher rate means that you can buy more USD which means more stocks. Lower rate means that already invested funds have greater value in Euro. So when you are implementing a dollar cost averaging strategy you can get a zero exchange risk in the long run.

Behind the scene, Revolut has partnered with DriveWealth to enable trading and Sapia partners act as intermediary.
Please also bear in mind that Revolut also charges a custody fee of 0.01% of the market value of your assets on an annual basis.
In addition any dividends paid from the companies will be credited to your investment account.

Something I wasn’t expecting happened this week. Revolut sent me an email about Visa’s shareholders meeting with a poll to fill in and this means you have a say in the companies you buy in.

I need to add a disclaimer here, that as I am not a professional financial trader, this posts should not be treated as financial advice as more of a how to guide and experience sharing.

Let’s continue with part 2 of the investing and diversifying your portfolio.
Next in the list is cryptocurrency also know as crypto.
4) In the cryptocurrency world Bitcoin is the king with 66% of the total market cap of cryptocurrencies. Second biggest player is of course Ethereum with 8% from there thousands other cryptocurrencies. You can buy and sell crypto in numerous websites and exchanges, including money apps like Revolut. My platform of choice for crypto is Coinbase one of the largest in the world. The way I purchase crypto is the following with 22 simple steps. Just kidding I have not counted them. The downside of Coinbase and other crypto apps are their commissions. In order to buy the convenient way it will cost a lot more than the hard way. If you purchase directly using credit/ debit card up to 4% + a margin compared to the current price of the crypto. To overcome this you can deposit money using SEPA transfers this is about 1 Euro per transfer, the money will appear in the account in about 2 business days. Next you login to with your Coinbase account, fees here are 0.5% a lot lower than in Coinbase, and transfer money from your Coinbase wallet. Then you can buy directly from the exchange. Previously maker orders where not charged any fees at all, but this has changed now. More on maker and taker orders and how to trade using Coinbase Pro in a future post.

5) Another asset class that I have in my investment portfolio is Equity crowdfunding, in other words you buy a small piece in a new company mostly startups. The two platforms that I have used in the past is Seedrs and Crowdcube , both UK based platforms. These have many interesting companies that you may like and want to invest in them. Keep in mind that only Seedrs has a secondary market and generally do not expect any return of investment for years, if at all. Only join because you want to support a company with great products. Another way to invest in a company is directly to the company you want to support, one of them is Brewdog where you can become a shareholder of a company with great beer. If you buy share please use R096584 as a referral code. A lot of perks apply for shareholders for example free delivery for online purchases for a year and 10% off at Brewdog bars around the world(This is awesome because you can walk in a Brewdog bar like you own the place and get a nice discount as a bonus!).

6) Real Estate/ Financing crowdfunding represent opportunities where you finance Real Estate opportunities or provide working capital for companies. The first that I ever used was Housers a Spanish platform where you fund various project types for example Development Loans,Fixed Interest or Buy-to-let from Spain,Portugal and Italy. In general most project promise great returns but I believe their due diligence could be better and the advertised returns lower to match actual performances. The second that I am using is Crowdestate an Estonian platform providing investment opportunities like Mortgage-backed loans,Secured loans,working capital etc. Crowdestate only offers funding opportunities with specified length, in contrast with Housers where you can invest indefinitely in an actual apartment for example. Again due diligence in companies that Crowdestate adds to the platforms should be more intense and diligent, pun intended.

That’s all from the asset classes I have in my portfolio, of course there are numerous other platforms and opportunities but I only discuss the ones that I have used personally.

Here you can see a pie chart of how I have invested my cryptocurrency portfolio

And here is the current state.

Current Value percentages by November 2019

As you can see Bitcoin dominates as the other cryptos have lost a lot more.

If you missed Part 1 you can find it here

The current state of Europe with negative deposit rates, low inflation and high housing prices can leave a young person baffling on what to do with its money except from consuming it.
There are ways available for European citizens to invest even a small amount and get the satisfaction that your money are sitting idle in your bank account.
Let’s start from the basics :
1) Always keep an emergency fund, yes I know it sucks to have money generating no income apart from a 0,05% per year(This is real for all Greek banks, some European are already charging customers with more than 500k€ in their account ) . The emergency fund should be your total spending for the next 3-6 months, including any loan payments – debt . This means that if you get in a no income situation you have a breathing room for the next months to figure things out.

2) Next there are platforms that allow you to invest in loans issued by Loan originators across Europe and the world. I personally use It offers buy back guarantee in most loans meaning that if a loan is delayed by more than 2 months the loan originator buys back the loan in full plus accrued interest. My investing strategy in Mintos is loans from European originators with buyback guarantee and 10%+ interest. This means mainly personal and car loans. I have been investing in Mintos for a little more than a year and the 10% has been pretty much consistent, compound interest starts becoming obvious very quickly. Problems can occur only in case of a loan originator paying late or defaulting. Personally only 1-2 loans from a specific originator were late. Of course you can diversify between originators. I will share my specific strategy in a later post. There are many more platforms like peerberry and fastinvest, that I have not tried as I don’t feel the need to diversify between platforms.

3) Revolut You may be wondering why a money app is third in my list, but Revolut has enabled US stock trading in their app. This means that you can exchange Euro to US Dollars and start trading. It allows fractional stocks and dividend payments. Keep in mind that EUR/USD exchange should be made Monday to Friday as Revolut offer worst rates during weekends, this is a tip also if you use it during traveling. So Revolut is offering 3 stock trades per month for the free tier,personally I feel it is enough for building up your stock portfolio. My strategy here is at the end of every month I exchange Euro to USD and load them on my investing account and split them between 3 stocks. Fractional shares let you buy exactly the percentage you need, for example you can buy 0.08 of Amazon or 0.5 Tesla stock for about 150$. In summary my future strategy here is buying stocks in new companies every month until I have at least 30-40 different stocks, after that I will continue increasing my position in them. I will share my stock research in a later post. With only 2 months of investing, as it just became available in Greece, my stock portfolio have increased in value by about 8-9% (at time of writing). I must have been lucky with my picks.

As this post is getting long enough I will split it up with a second part that will include cryptocurrency, equity crowdfunding, real estate crowdfunding and investment crowdfunding.

Here is a pie chart with the percentage that I have invested/saved by type.

And this is a pie chart with current value percentage after any gains or losses – writeoffs.

As you see my cryptocurrency percentage has fallen a lot as it is a real bear market for crypto. On the other hand Microloans A.K.A. Mintos and the US stock market is doing great thats why they are the first I included in my post.

Στα πλαίσια του έργου “Ηλεκτρονικές Υπηρεσίες για την Ανάπτυξη και τη Διάδοση του Ανοιχτού Λογισμικού” το οποίο διενεργήθηκε από το ΕΔΕΤ σε συνεργασία με την ΕΕΛ/ΛΑΚ ανέλαβα την ανάπτυξη πυλών πληρωμής για τη δημοφιλή πλατφόρμα ηλεκτρονικού εμπορίου Woocommerce

To Woocommerce είναι ένα plug-in το οποίο αναπτύσεται στηριζόμενο στο πιο δημοφιλές CMS  στο ίντερνετ αυτή τη στιγμή το WordPress.

Αναπτύχθηκαν 2 plug-in που προσφέρουν διασύνδεση για πληρωμές με χρήση καρτών ( πιστωτικών / χρεωστικών / προπληρωμένων ) για τις Τράπεζες Πειραιώς και Εθνική. Η χρήση καρτών είναι η καλύτερη λύση τόσο για τους έμπορους για την εξασφάλιση των πληρωμών τους  όσο και για τους καταναλωτές για την εξασφάλιση των αγορών τους.

Τα plug-in προσφέρονται με άδεια ΕΛΛΑΚ και ο πηγαίος κώδικας είναι διαθέσιμος στο Github.

Επίσης μπορείτε να κατεβάσετε ή να εγκαταστήσετε απευθείας στη WordPress εγκατάστασή σας από το αποθετήριο του WordPress στους παρακάτω συνδέσμους.

Εθνική Τράπεζα: National Bank of Greece Payment Gateway for Woocommerce

Τράπεζα Πειραιώς : Piraeus Bank Greece Payment Gateway for WooCommerce

Tα Plug-in χρησιμοποιούν τη μέθοδο redirect και δεν απαιτείται η ύπαρξη SSL στο site.

Έχουν δοκιμαστεί για τις εκδόσεις WP 4.+ και Woocommerce 2.3+ .

I come across a pretty annoying bug-feature in woocommerce. If someone uses Layered navigation filters and has variable products based on a specific attribute, the filtering will return all the products with the specific attribute, even if this variation is out of stock.  If someone  is selling clothes-shoes for example this is quite disturbing.

This bug is reported to Woocommerce github issue tracker here. It is rated as a won’t fix mainly because the attributes of a variable product is not directly connected with the Taxonomy Terms.

Building upon a solution from which is removing the products before showing in the template pages , I went deeper in the woocommerce core. This was mainly because the aforementioned solution had trouble with more advanced themes and especially with the pagination. In simple themes it worked almost perfectly.

So this is my solution.

Open file in woocommerce plugin -> includes -> class-wc-query.php

Find Function


public function layered_nav_query( $filtered_posts ) {




global $_chosen_attributes;



[php]     global $wpdb;[/php]

And after

$posts = get_posts(
‘post_type’     = > ‘product’,
‘numberposts’     = > -1,
‘post_status’     = > ‘publish’,
‘fields’         => ‘ids’,
‘no_found_rows’ => true,
‘tax_query’ => array(
‘taxonomy’     => $attribute,
‘terms’     => $value,
‘field’     => ‘term_id’



//continue fix
if ($attribute ==”pa_size”)    {
$new_ids= array();
$queryslug =”SELECT *  FROM {$wpdb->prefix}term_taxonomy as taxonomy, {$wpdb->prefix}terms as term  where taxonomy.term_id= $value and taxonomy.term_id = term.term_id ” ;
$slugr = $wpdb->get_results( $queryslug );
$slug = $slugr[0]->slug;
foreach ($posts as $post_id)
$query =”SELECT *  FROM {$wpdb->prefix}posts as posts , {$wpdb->prefix}postmeta as postmeta where posts.post_parent= $post_id  AND posts.ID = postmeta.post_id AND meta_key like ‘attribute_$attribute’  AND meta_value like ‘$slug’ ” ;
$variation_ids = $wpdb->get_results( $query );
foreach ($variation_ids as $variation_id){
$var_id = $variation_id->ID;
$query2 =”SELECT post_id  FROM {$wpdb->prefix}postmeta as postsmeta  where post_id= $var_id and meta_key like ‘_stock_status’ and meta_value like ‘instock’ ” ;
$result = $wpdb->get_results( $query2 );
//END fix


Where pa_size can be renamed to your attribute.