Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils.api.productAttributes.optionChange can't convert null to object #164

Open
sfroment opened this issue Dec 15, 2021 · 1 comment
Open

Comments

@sfroment
Copy link

sfroment commented Dec 15, 2021

if you use a demo store in the console simply run this

window.stencilUtils.api.productAttributes.optionChange(77, "action=add&product_id=77&attribute%5B108%5D=69&attribute%5B109%5D=10&qty%5B%5D=1", function (err, resp) {
                console.log('err', err);
                console.log('resp', resp);
            });

and you'll have the error can't convert null to object

@pvaladez
Copy link

pvaladez commented Jan 18, 2022

The api.optionChange function does set the template argument to null as a default value, so I would think this is a bug.

However, as a workaround, you can just include a template file in the call:

window.stencilUtils.api.productAttributes.optionChange(77, "action=add&product_id=77&attribute%5B108%5D=69&attribute%5B109%5D=10&qty%5B%5D=1", 'products/product-view', function (err, resp) {
                console.log('err', err);
                console.log('resp', resp);
            });

Note: The version of Cornerstone I was referencing(6.1.3) is using stencil-utils 6.8.1, but the last release listed on GitHub is 6.3.0...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants