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

fix(useCart): canAddToCart not working correctly #1417

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/composition/composables.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To make composables easily distinguishable from standard methods, we follow the

### What does it look like in practice?

Let's take a closer look at how it might look like using the [useUser](/api-reference/magento-theme.useuserinterface.html) composable as an example:
Let's take a closer look at how it might look like using the [useUser](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/customer/composables/useUser/index.ts) composable as an example:

<img
src="../assets/images/useUser-composable-anatomy.webp"
Expand All @@ -37,7 +37,7 @@ In this example:

## Usage

Let's see how you can use the [useUser](/api-reference/magento-theme.useuserinterface.html) composable to load the current user's data:
Let's see how you can use the [useUser](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/customer/composables/useUser/useUser.ts#L61) composable to load the current user's data:

```vue
<script>
Expand Down
70 changes: 35 additions & 35 deletions docs/composition/list-of-composables.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,208 +4,208 @@

Allows loading and manipulating addresses of the current user. These addresses can be used for both billing and shipping.

See the [UseAddressesInterface](/api-reference/magento-theme.useaddressesinterface.html) for more information.
See the [UseAddressesInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/customer/composables/useAddresses/useAddresses.ts#L9) for more information.

## `useApi`

Allows executing arbitrary GraphQL queries and mutations.

See the [UseApiInterface](/api-reference/magento-theme.useapiinterface.html) for more information.
See the [UseApiInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useApi/index.ts#L29) for more information.

## `useBilling`

Allows loading and saving billing information of the current cart.

See the [UseBillingInterface](/api-reference/magento-theme.usebillinginterface.html) for more information.
See the [UseBillingInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/checkout/composables/useBilling/useBilling.ts#L54) for more information.

## `useCart`

Allows loading and manipulating cart of the current user.

See the [UseCartInterface](/api-reference/magento-theme.usecartinterface.html) for more information.
See the [UseCartInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/checkout/composables/useCart/useCart.ts#L46) for more information.

## `useCategory`

Allows loading categories from Magento API. It is commonly used in navigation menus, and provides the load function and refs for the categories, loading and error.

See the [UseCategoryInterface](/api-reference/magento-theme.usecategoryinterface.html) for more information.
See the [UseCategoryInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/catalog/category/composables/useCategory/useCategory.ts#L53) for more information.

## `useCategorySearch`

Allows searching for categories. It is commonly used in subtrees navigation.

See the [UseCategorySearchInterface](/api-reference/magento-theme.usecategorysearchinterface.html) for more information.
See the [UseCategorySearchInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/catalog/category/composables/useCategorySearch/useCategorySearch.ts#L23) for more information.

## `useConfig`

Allows interacting with the store configuration.

See the [UseConfigInterface](/api-reference/magento-theme.useconfiginterface.html) for more information.
See the [UseConfigInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useConfig/useConfig.ts#L23) for more information.

## `useContent`

Allows loading CMS Pages or Blocks from Magento API.

See the [UseContentInterface](/api-reference/magento-theme.usecontentinterface.html) for more information.
See the [UseContentInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useConfig/useConfig.ts#L23) for more information.

## `useCountrySearch`

Allows fetching a list of countries or a single country by ID

See the [UseCountrySearchInterface](/api-reference/magento-theme.usecountrysearchinterface.html) for more information.
See the [UseCountrySearchInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useCountrySearch/useCountrySearch.ts#L30) for more information.

## `useCurrency`

Allows loading and changing the currency.

See the [UseCurrencyInterface](/api-reference/magento-theme.usecurrencyinterface.html) for more information.
See the [UseCurrencyInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useCountrySearch/useCountrySearch.ts#L30) for more information.

## `useExternalCheckout` (Work in progress)

Allows redirecting to external checkout process. It depends on the [magento2-external-checkout repository](https://github.com/Vendic/magento2-external-checkout).

See the [UseExternalCheckoutInterface](/api-reference/magento-theme.useexternalcheckoutinterface.html) for more information.
See the [UseExternalCheckoutInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useExternalCheckout/useExternalCheckout.ts#L12) for more information.

## `useFacet`

Allows searching for products with pagination, totals and sorting options.

See the [UseFacetInterface](/api-reference/magento-theme.usefacetinterface.html) for more information.
See the [UseFacetInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/catalog/category/composables/useFacet/useFacet.ts#L58) for more information.

## `useForgotPassword`

Allows to request a password reset email and to set a new password to a user.

Se the [UseForgotPasswordInterface](/api-reference/magento-theme.useforgotpasswordinterface.html) for more information.
Se the [UseForgotPasswordInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/customer/composables/useForgotPassword/useForgotPassword.ts#L33) for more information.

## `useGetShippingMethods`

Allows fetching shipping methods available for a given cart.

See the [UseGetShippingMethodsInterface](/api-reference/magento-theme.usegetshippingmethodsinterface.html) for more information.
See the [UseGetShippingMethodsInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/checkout/composables/useGetShippingMethods/useGetShippingMethods.ts#L14) for more information.

## `useGuestUser`

Allows to attach a guest cart to a user.

See the [UseGuestUserInterface](/api-reference/magento-theme.useguestuserinterface.html) for more information.
See the [UseGuestUserInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/customer/composables/useGuestUser/useGuestUser.ts#L20) for more information.

## `useImage`

Allows extracting image paths from magento URL.

See the [UseImageInterface](/api-reference/magento-theme.useimageinterface.html) for more information.
See the [UseImageInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useImage/useImage.ts#L29) for more information.

## `useMagentoConfiguration`

Allows getting the Magento's major definitions, e.g., the selected currency, store, locale, and config object.

See the [UseMagentoConfigurationInterface](/api-reference/magento-theme.usemagentoconfigurationinterface.html) for more information.
See the [UseMagentoConfigurationInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useMagentoConfiguration/UseMagentoConfiguration.ts#L7) for more information.

## `useMakeOrder`

Allows making an order from a cart.

See the [UseMakeOrderInterface](/api-reference/magento-theme.usemakeorderinterface.html) for more information.
See the [UseMakeOrderInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/checkout/composables/useMakeOrder/useMakeOrder.ts#L17) for more information.

## `useNewsletter`

Allows updating the subscription status of an email in the newsletter.

See the [UseNewsletterInterface](/api-reference/magento-theme.usenewsletterinterface.html) for more information.
See the [UseNewsletterInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useNewsletter/useNewsletter.ts#L25) for more information.

## `usePaymentProvider`

Allows loading the available payment methods for current cart, and selecting (saving) one of them.

See the [UsePaymentProviderInterface](/api-reference/magento-theme.usepaymentproviderinterface.html) for more information.
See the [UsePaymentProviderInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/checkout/composables/usePaymentProvider/usePaymentProvider.ts#L31) for more information.

## `useProduct`

Allows loading product details or list with params for sorting, filtering and pagination.

See the [UseProductInterface](/api-reference/magento-theme.useproductinterface.html) for more information.
See the [UseProductInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/catalog/product/composables/useProduct/useProduct.ts#L25) for more information.

## `useRelatedProducts`

Allows searching for related products with params for sort, filter and pagination.

See the [UseRelatedProductsInterface](/api-reference/magento-theme.userelatedproductsinterface.html) for more information.
See the [UseRelatedProductsInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/catalog/product/composables/useRelatedProducts/useRelatedProducts.ts#L23) for more information.

## `useReview`

Allows loading and adding product reviews.

See the [UseReviewInterface](/api-reference/magento-theme.usereviewinterface.html) for more information.
See the [UseReviewInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/review/composables/useReview/useReview.ts#L50) for more information.

## `useShipping`

Allows loading the shipping information for the current cart and saving (selecting) other shipping information for the same cart.

See the [UseShippingInterface](/api-reference/magento-theme.useshippinginterface.html) for more information.
See the [UseShippingInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/checkout/composables/useShipping/useShipping.ts#L28) for more information.

## `useShippingProvider`

Allows loading the shipping provider for the current cart and saving (selecting) other shipping provider for the same cart.

See the [UseShippingProviderInterface](/api-reference/magento-theme.useshippingproviderinterface.html) for more information.
See the [UseShippingProviderInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/checkout/composables/useShippingProvider/useShippingProvider.ts#L35) for more information.

## `useStore`

Allows loading and changing currently active store.

See the [UseStoreInterface](/api-reference/magento-theme.usestoreinterface.html) for more information.
See the [UseStoreInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useStore/useStore.ts#L23) for more information.

## `useUiHelpers`

Allows handling the parameters for filtering, searching, sorting and pagination in the URL search/query params.

See the [UseUiHelpersInterface](/api-reference/magento-theme.useuihelpersinterface.html) for more information.
See the [UseUiHelpersInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useUiHelpers/useUiHelpers.ts#L8) for more information.

## `useUiNotification`

Allows managing and showing notifications to the user.

See the [UseUiNotificationInterface](/api-reference/magento-theme.useuinotificationinterface.html) for more information.
See the [UseUiNotificationInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useUiNotification/useUiNotification.ts#L22) for more information.

## `useUiState`

Global store for managing UI state.

See the [UseUiStateInterface](/api-reference/magento-theme.useuistateinterface.html) for more information.
See the [UseUiStateInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useUiState/useUiState.ts#L17) for more information.

## `useUpsellProducts`

Allows loading upsell products.

See the [UseUpsellProductsInterface](/api-reference/magento-theme.useupsellproductsinterface.html) for more information.
See the [UseUpsellProductsInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/catalog/product/composables/useUpsellProducts/useUpsellProducts.ts#L23) for more information.

## `useUrlResolver`

Allows searching the resolver for current route path (URL).

See the [UseUrlResolverInterface](/api-reference/magento-theme.useurlresolverinterface.html) for more information.
See the [UseUrlResolverInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/composables/useUrlResolver/UseUrlResolver.ts#L22) for more information.

## `useUser`

Allows loading and manipulating data of the current user.

See the [UseUserInterface](/api-reference/magento-theme.useuserinterface.html) for more information.
See the [UseUserInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/customer/composables/useUser/useUser.ts#L61) for more information.

## `useUserAddress`

Allows loading and manipulating addresses of the current user.

See the [UseUserAddressInterface](/api-reference/magento-theme.useuseraddressinterface.html) for more information.
See the [UseUserAddressInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/customer/composables/useUserAddress/useUserAddress.ts#L61) for more information.

## `useUserOrder`

Allows fetching customer orders.

See the [UseUserOrderInterface](/api-reference/magento-theme.useuserorderinterface.html) for more information.
See the [UseUserOrderInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/customer/composables/useUserOrder/useUserOrder.ts#L24) for more information.

## `useWishlist`

Allows loading and manipulating wishlist of the current user.

See the [UseWishlistInterface](/api-reference/magento-theme.usewishlistinterface.html) for more information.
See the [UseWishlistInterface](https://github.com/vuestorefront/magento2/blob/main/packages/theme/modules/wishlist/composables/useWishlist/useWishlist.ts#L74) for more information.
Loading