controlaltdelete / swatches-sku
Package info
github.com/controlaltdelete-nl/magento2-swatches-sku
Language:JavaScript
Type:magento2-module
pkg:composer/controlaltdelete/swatches-sku
v1.0.0
2023-01-25 14:40 UTC
Requires
- magento/framework: *
README
Description
This module allows you to retrieve the SKU of the current selected SKU.
Usage
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(); });
Contribution
Any contribution is highly appreciated. The best way to contribute code is to open a pull request on GitHub.
Licence
OSL - Open Software Licence 3.0