By now you may know that Data sources are the main place where you can edit the business logic of a widget. For instance, if the Holidays are approaching, we may find it useful to return a Christmas collection to the customer. As such, we want to test what our widgets will show before they are seen by customers. In this doc you will learn how to test your data sources using the Data Source Manager.
Data Source Manager
This doc assumes that you have already gone through the process of building and setting up a data source but now want to test that it's working. Start by navigating to the data source you want to test and clicking on 'Preview Ruleset.
This will bring you to a page that looks like this.
Here you will see the six major sections,
Data Source: Input
API Endpoint
Data Source: Output
Data Source: Rules
Data Source: Filtered out of stock products
Data Source: Filtered input products
Data Source: Input
This section is where you will pretend to be a customer and buy a product. Below are all the inputs you can use in testing a data source, to get a detailed overview of it click on the drop down of each one.
Set the number of items to return (Limit)
Set the number of items to return (Limit)
This setting is used to test what products may be returned if you had set in your widgets settings under layout how many items to show.
We can see here when I set the product limit to 10 like so even though the widget is set to only show 1 item we return 10 this is because the data source does not look at the widgets settings.
β
Set the Customer ID
Set the Customer ID
This input field is useful if you are using rules that pertain to customers IE if customer tags contains wholesale
the customers ID can be extracted from the URL while viewing the customers profile like so.
And then enter it into the customer ID field like below
β
You should see an output that shows the customer name and any matched rules or unmatched rules if there were any.
API Endpoint
This section has a sample API endpoint that you can use. This is not necessary to test most issues but useful if you are a developer who doesn't want to use our Data Source Manger.
Clicking on that endpoint will give open a new tab in your browser and return a JSON object of the output like below.
Data Source: Output
Once you have run a simulation, this section will show what has been output by the data source. This is an example of what the customer should see.
Data Source: Rules
After running a simulation, this section will display which data source rules have either been matched, unmatched, or not evaluated.
Data Source: Filtered out of stock products
Once you have run a simulation, this section will show what products have been filtered due to being out of stock. This will only show products if you have Filter Out Of Stock active on the data source settings.
Data Source: Filtered input products
Once you have run a simulation, this section will show what products have been filtered based off the input into the data source. This will only show products if you have Filter Input Products active on the data source settings.