Need help to replace TRUE and FALSE with other words.

Hello! I am making a shop using dynamic pages and collections. So I tried to pull the Boolean for “In Stock” and it shows up as TRUE or FALSE in a text box. How can I make TRUE to be In Stock and FALSE be Out of Stock? Also, how could that work with two languages? Thanks for any help!

Please note I am an Unreal Engine developer working with Blueprints, therefore a visual coder. Some specific instructions on where and how to add the code I need would be greatly appreciated.

To turn true to —> “whatever”

if (true) {let myNewValue=“×××××”}
else {let myNewValue=“yyyyy”}

Pay attention, that you convert your value-typ from → boolean → to → string!

If you want also to ckeck for different languages, add a further if-else-query into the already existing.

BTW: How good are your UE-Coding-developing-Skills?

Can you please also tell me where should I place that code? I am very good with UE, just not into C++, only Blueprints. I can make inventories, vehicles, subtitle systems, task systems, most goodies.

@ntinos83
To know, where and how to implement the shown code depends on your project’s and DB - structure.

Your DBs are already prepared?
Do you already use some code?
Do you create a totaly custom Shop, or do you use wix-stores-app?
Do you use DATASETS?
Do you use dynamic pages?

There are so many unknown informations, so it makes almost impossible to give you a right answer.

Elaborate AMD describe a little bit your project-setup, which Elements are used and which DBs are included and how everything is connected with each other.

It is very simple…
The more INPUT → The more OUTPUT.

If you worked without code until this momentan, then first activate DEV-MODE in your Wix-Editor.

@russian-dima Yes, I worked without code so far, I am using a repeater that pulls the “In Stock” Boolean from a dataset for a text element. I know how to activate the dev mode, and that’s where my knowledge about it ends!

You did not answer a lot of questions, but at least you should answer 1 important question.

  1. Do you use → wix-stores-app?
  2. Or are you trying to generate your own custom store?

When you are talking about → “in-stock”, it sounds like you are using the wix-stores-app, which you may already have installed in your site.

Yes, I am using the stores app, with dynamic pages.

You would need something similar to this one…

$w.onReady(async function() { 	
	$w('#REPEATER').onItemReady(($item, itemData, index)=>{
		let inStock = itemData.inStock;
		 $w('#TEXTFIELD').text = inStock ;

		if (inStock===true) {console.log("Yes, item is still in stock!); 
			if(lang = "EN") {console.log("English"); let myNewValue="xxxxx";}
			else {console.log("Other language!");}
			
		}
		else {console.log("Item not in stock anymore!); 
			let myNewValue="yyyyy"
		}
	});
});

@russian-dima Sorry for being a noob. This is where I got.

@ntinos83
The code-part with → “lang” ← was just an example

“lang” is anywhere declared in your (my) code.
You have first to define/declare → “lang”

How to do that???

Paste the orange marked additional CODE like shown below into your own one…

$w('#REPEATER').onItemReady(($item,itemData,index)=>{console.log(itemData);

Open the → CONSOLE ← and inspect the → itemData-RESULTS ←

Look for the results which will give you back the current used language.
Then you do the same declaration, like i did with → “inStock”…

let inStock = itemData.inStock;

…for lang (language).

Find the right result-data and declare a variable, the same way like already done with → “inStock”.

Also pay attention onto all the other given CONSOLE-LOGS, which will help you to understand your own CODE much better!