Solved

How to create flow to update properties

  • 14 February 2023
  • 3 replies
  • 72 views

Userlevel 4
Badge +7

I have an add to cart pop up ie when customers click on add to cart they are offered the opportunity to personalise their experience. I get the hidden properties of the product they added to cart to trigger the pop up. Question is how ccan get this field value into our custom property field for Brand? I will also need to be able to trim the field ie to remove product model number so that only Brand name enters the custom property...

 

Thanks

icon

Best answer by Irrra 14 February 2023, 15:17

View original

3 replies

Userlevel 5
Badge +15

Hi @SeanMcC !

Assuming you have access to the code that triggers the pop up and the custom property field for Brand, you can extract the Brand name from the product properties and store it in the custom property field by using string manipulation methods.

Here's an example in JavaScript:

// get the hidden properties of the product

var productProperties = getProductProperties();

// extract the Brand name from the properties

var brandName = productProperties.Brand;

// remove the product model number from the brand name

var trimmedBrandName = brandName.replace(/-\d+$/, '');

// set the custom property field for Brand to the trimmed brand name

setCustomProperty('Brand', trimmedBrandName);

 

In this example, getProductProperties() is a function that returns an object with the hidden properties of the product, setCustomProperty() is a function that sets the value of a custom property field, and the regular expression /-\d+$/ matches a hyphen followed by one or more digits at the end of a string. The replace() method removes this pattern from the brand name.

Note that the code may vary depending on the programming language and the platform you're using.

 

Userlevel 4
Badge +7

@Irrra Thanks for your reply. I will pass this to our developer. Many Thanks

Userlevel 5
Badge +15

@SeanMcC 
You are always welcome, if you have any other questions, you can always contact)

Reply