Reputation: 11
My local setup of venia-ui pwa is throwing an error :
Cannot query field "applied_gift_cards" on type "Cart".
The same setup without any difference in the code is working when the code is pushed onto the server , the error justify itself as there is something wrong in the graphql Query.
But the query itself is working fine independently.
Can anyone please suggest any help for the same.
I've Tried changing the graphql queries and validating the data coming from cart, But when i use
import { gql } from '@apollo/client';
import { GiftCardFragment } from '/GiftCards/giftCardFragments.gql';
import { ProductListingFragment } from '@magento/peregrine/lib/talons/CartPage/ProductListing/productListingFragments.gql';
import { PriceSummaryFragment } from '@magento/peregrine/lib/talons/CartPage/PriceSummary/priceSummaryFragments.gql';
import { AppliedCouponsFragment } from '@magento/peregrine/lib/talons/CartPage/PriceAdjustments/CouponCode/couponCodeFragments.gql';
export const CartPageFragment = gql`
fragment CartPageFragment on Cart {
id
total_quantity
...AppliedCouponsFragment
...GiftCardFragment
...ProductListingFragment
...PriceSummaryFragment
}
${AppliedCouponsFragment}
${GiftCardFragment}
${ProductListingFragment}
${PriceSummaryFragment}
`;
Then it returns the data as undefined, But after removing the fragments of
${AppliedCouponsFragment}
${GiftCardFragment}
${PriceSummaryFragment}
These three the page return the data, but then it throws a error on performing actions on the cart
Cannot query field "applied_gift_cards" on type "Cart".
the code of the three fragments are :
id
applied_coupons {
code
}
}
fragment GiftCardFragment on Cart {
__typename
id
}
fragment PriceSummaryFragment on Cart {
id
# eslint-disable-next-line @graphql-eslint/require-id-when-available
items {
uid
quantity
}
...ShippingSummaryFragment
prices {
...TaxSummaryFragment
...DiscountSummaryFragment
...GrandTotalFragment
subtotal_excluding_tax {
currency
value
}
subtotal_including_tax {
currency
value
}
}
...GiftCardSummaryFragment
...GiftOptionsSummaryFragment
}
Upvotes: 0
Views: 233
Reputation: 11
I've Found the answer to this issue. It was related to the version of the PWA application installed.
Earlier I'd installed the PWA with AC (Adobe) configurations, but my magento2 backend was a Community edition; that’s why the conflict of the Gift card module happened.
Upvotes: 1