@anker-in/shopify-react 1.0.1-beta.1 → 1.0.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -892,14 +892,10 @@ function useApplyCartCodes(options) {
892
892
  const { mutateCart, cart, metafieldIdentifiers } = useCartContext();
893
893
  const applyCodes = react.useCallback(
894
894
  async (_key, { arg }) => {
895
- const { cartId: providedCartId, discountCodes, replaceExistingCodes } = arg;
895
+ const { cartId, discountCodes, replaceExistingCodes } = arg;
896
896
  if (!discountCodes?.length) {
897
897
  throw new Error("Invalid input used for this operation: Miss discountCode");
898
898
  }
899
- const cartId = providedCartId || cart?.id;
900
- if (!cartId) {
901
- return void 0;
902
- }
903
899
  const updatedCart = await shopifySdk.updateCartCodes(client, {
904
900
  cartId,
905
901
  discountCodes: replaceExistingCodes ? discountCodes : [
@@ -929,8 +925,7 @@ function useRemoveCartCodes(options) {
929
925
  const { mutateCart, cart, metafieldIdentifiers } = useCartContext();
930
926
  const removeCodes = react.useCallback(
931
927
  async (_key, { arg }) => {
932
- const { cartId: providedCartId, discountCodes } = arg;
933
- const cartId = providedCartId || cart?.id;
928
+ const { cartId, discountCodes } = arg;
934
929
  const codes = cart?.discountCodes?.filter((code) => !!code.applicable) || [];
935
930
  const leftCodes = codes.filter((code) => discountCodes?.length ? !discountCodes.includes(code.code) : code.code).map((code) => code.code);
936
931
  const updatedCart = await shopifySdk.updateCartCodes(client, {