This module allows you to retrieve the SKU of the current selected SKU.
Require it in your component:
define([
'uiComponent',
'ControlAltDelete_SwatchesSku/js/model/selected-product-sku',
], function (
Component,
sku
) {
'use strict';
return Component.extend({
sku: sku
});
});
And then in your HTML:
<!-- Output the selected SKU -->
<span data-bind="text: sku"></span>
But you can also use it with computed observables:
var result = ko.computed( function () {
return 'The selected SKU is ' + sku();
});
Any contribution is highly appreciated. The best way to contribute code is to open a pull request on GitHub.