Hiding WaveCreate button if there are no awaiting_wave fulfilment for the location.
Author:
Fluent Commerce
Changed on:
10 Sept 2024
Key Points
- OOTB, the create wave button on Fluent Store will always be displayed whether there are pending fulfilments or not.
- It’s possible to only display the button when there are pending waves when a condition is added.
Steps
Adding the condition for wave creation button
Here is the trick to hide the Create Wave button from Fluent Store if there are no pending fulfilment for processing. If the button is visible, the store user can create a new Wave with empty details.
1 "props": {
2 "title": "i18n:fc.sf.ui.waves.index.wavesList.title",
3 "actions": {
4 "primary": [
5 {
6 "type": "userAction",
7 "name": "WaveCreate",
8 "condition": "{{gt fulfilments.edges.length 0}}"
9 }
10 ],
11 "userActionExtensions": {
12 "WaveCreate": {
13 "postSubmit": {
14 "type": "navigate",
15 "link": "/waves/{{wavesInProgress.edges.0.node.id}}"
16 }
17 }
18 }
19 }
20 },
21
Language: json
Name: condition
Description:
[Warning: empty required content area]The above trick is to utilise the
` "condition": "{{gt fulfilments.edges.length 0}}"`
Callout:
Please note that this is just a temporary workaround as in the current situation, the extension within actions are not working. Once this is fixed, we might able to use below code:
1 "props": {
2 "title": "i18n:fc.sf.ui.waves.index.wavesList.title",
3 "actions": {
4 "primary": [
5 {
6 "type": "userAction",
7 "name": "WaveCreate",
8 "extensions": {
9 "postSubmit": {
10 "type": "navigate",
11 "link": "/waves/{{wavesInProgress.edges.0.node.id}}"
12 }
13 },
14 "condition": "false"
15 }
16 ]
17 }
18 },
Language: json
Name: expected code
Description:
[Warning: empty required content area]