@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.
@@ -883,14 +883,10 @@ function useApplyCartCodes(options) {
883
883
  const { mutateCart, cart, metafieldIdentifiers } = useCartContext();
884
884
  const applyCodes = useCallback(
885
885
  async (_key, { arg }) => {
886
- const { cartId: providedCartId, discountCodes, replaceExistingCodes } = arg;
886
+ const { cartId, discountCodes, replaceExistingCodes } = arg;
887
887
  if (!discountCodes?.length) {
888
888
  throw new Error("Invalid input used for this operation: Miss discountCode");
889
889
  }
890
- const cartId = providedCartId || cart?.id;
891
- if (!cartId) {
892
- return void 0;
893
- }
894
890
  const updatedCart = await updateCartCodes(client, {
895
891
  cartId,
896
892
  discountCodes: replaceExistingCodes ? discountCodes : [
@@ -920,8 +916,7 @@ function useRemoveCartCodes(options) {
920
916
  const { mutateCart, cart, metafieldIdentifiers } = useCartContext();
921
917
  const removeCodes = useCallback(
922
918
  async (_key, { arg }) => {
923
- const { cartId: providedCartId, discountCodes } = arg;
924
- const cartId = providedCartId || cart?.id;
919
+ const { cartId, discountCodes } = arg;
925
920
  const codes = cart?.discountCodes?.filter((code) => !!code.applicable) || [];
926
921
  const leftCodes = codes.filter((code) => discountCodes?.length ? !discountCodes.includes(code.code) : code.code).map((code) => code.code);
927
922
  const updatedCart = await updateCartCodes(client, {