Skip to content

controlaltdelete-nl/magento2-swatches-sku

Repository files navigation

ControlAltDelete SwatchesSku Extension

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

Copyright

(c) Control Alt Delete

About

Get the SKU of the selected simple product.

Resources

Stars

Watchers

Forks

Packages

No packages published