Hello i'm looking to add the success page as a step in the step navigator. I followed the following tutorial on how to make an extra step but i'm unsure on how to connect the success page to it.
My current files:
success-step.html
<li id="success_step" data-bind="fadeVisible: isVisible">
<div class="step-title" data-bind="i18n: 'Success'" data-role="title"></div>
<div id="checkout-step-title"
class="step-content"
data-role="content">
</div>
</li>
success-step.js
define(
[
'ko',
'uiComponent',
'underscore',
'Magento_Checkout/js/model/step-navigator'
],
function (
ko,
Component,
_,
stepNavigator
) {
'use strict';
return Component.extend({
defaults: {
template: 'BigBridge_Checkout/success-step'
},
isVisible: ko.observable(true),
/**
*
* @returns {*}
*/
initialize: function () {
this._super();
// register your step
stepNavigator.registerStep(
//step code will be used as step content id in the component template
'success_step',
//step alias
null,
//step title value
'Success',
//observable property with logic when display step or hide step
this.isVisible,
_.bind(this.navigate, this),
/**
* sort order value
* 'sort order value' < 10: step displays before shipping step;
* 10 < 'sort order value' < 20 : step displays between shipping and payment step
* 'sort order value' > 20 : step displays after payment step
*/
30
);
return this;
},
/**
* The navigate() method is responsible for navigation between checkout step
* during checkout. You can add custom logic, for example some conditions
* for switching to your custom step
*/
navigate: function () {
},
/**
* @returns void
*/
navigateToNextStep: function () {
stepNavigator.next();
}
});
}
);
checkout_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="shipping-step" xsi:type="array">
</item>
<item name="billing-step" xsi:type="array">
</item>
<item name="success-step" xsi:type="array">
<item name="component" xsi:type="string">BigBridge_Checkout/js/view/success-step</item>
<item name="sortOrder" xsi:type="string">3</item>
<item name="children" xsi:type="array">
<!--add here child component declaration for your step-->
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
Any idea?
It also seems like the success step is instantly enabled at the moment on step 1?