vuestorefront/magento2

[Bug]: Variable might not have been initialized in useCart addItemCommand

sequensucks opened this issue · 0 comments

Expected Behavior

No response

Actual Behavior

packages/theme/modules/checkout/composables/useCart/commands/addItemCommand.ts:159

case 'VirtualProduct':

if (downloadableProduct.data.addProductsToCart.user_errors.length > 0) {
  throw new Error(String(downloadableProduct.data.addProductsToCart.user_errors[0].message));
}

but we set response to the virtualProduct variable.

need to replace this code with

if (virtualProduct.data.addProductsToCart.user_errors.length > 0) {
  throw new Error(String(virtualProduct.data.addProductsToCart.user_errors[0].message));
}

Possible Solution

No response

Steps to reproduce

No response

What version of Magento 2 integration are you using?

2.4.3

What version of Node.js are you using?

v16.12.0

What browser (and version) are you using?

Chrome Version 94.0.4606.71 (Official Build) (x86_64)

What operating system (and version) are you using?

macOS Version 11.6 (20G165)

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct