refine icon indicating copy to clipboard operation
refine copied to clipboard

feat: Message was shown to the user when chosen more than the count of the stock #2916

Open 5evki opened this issue 2 years ago • 5 comments

…roduct

IMPORTANT: Please do not create a Pull Request without creating an issue first.

Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.

Please provide enough information so that others can review your pull request:

Explain the details for making this change. What existing problem does the pull request solve?

Test plan (required)

Demonstrate the code is solid. If not, please add WIP: in its title.

Closing issues

Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

Self Check before Merge

Please check all items below before review.

  • [ ] Corresponding issues are created/updated or not needed
  • [ ] Docs are updated/provided or not needed
  • [ ] Examples are updated/provided or not needed
  • [ ] TypeScript definitions are updated/provided or not needed
  • [ ] Tests are updated/provided or not needed
  • [ ] Changesets are provided or not needed

5evki avatar Nov 18 '22 22:11 5evki

⚠️ No Changeset found

Latest commit: 2427e909e0e5ecd2dd00ebf5e92567aa90cda5aa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Nov 18 '22 22:11 changeset-bot[bot]

Deploy Preview for refine-doc-live-previews ready!

Name Link
Latest commit 2427e909e0e5ecd2dd00ebf5e92567aa90cda5aa
Latest deploy log https://app.netlify.com/sites/refine-doc-live-previews/deploys/637de4b5b4285c00088dc3b6
Deploy Preview https://deploy-preview-3020--refine-doc-live-previews.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Nov 18 '22 22:11 netlify[bot]

Hey @sevkioruc, thank you for your effort! Unfortunately, stocks being limited to 5 is just a coincidence 😅Instead of checking for count >= 6 we should check for the errors in updateMutate response and show a warning when we get stock error 🚀

Hope this is clear 🤔 Can you update the code according to the above? 🙏 🙏

aliemir avatar Nov 21 '22 08:11 aliemir

Hey @aliemir, I hope I will update code at this night.

5evki avatar Nov 21 '22 09:11 5evki

Hey @aliemir, @omeraplak, Could you please review it?

5evki avatar Nov 22 '22 15:11 5evki

Hey @sevkioruc , I broke your fork repo while committing for the review :)

My change suggestion was as follows,

CartItem.tsx

<Quantity
                 value={quantity}
                 handleRemove={removeItem}
                 handleChange={handleChange}
                 increase={() => increaseQuantity(1)}
                 decrease={() => increaseQuantity(-1)}
                 max={item.variant.inventory_quantity} // here
             />

Quantity.tsx

  <button
                 type="button"
                 onClick={increase}
                 className={cn(s.actions)}
                 style={{ marginLeft: "-1px" }}
                 disabled={value < 1 || value >= max}
                 title={value < 1 || value >= max ? "Max quantity reached" : ""} // here
             >

omeraplak avatar Nov 23 '22 09:11 omeraplak

Hey @omeraplak , I agree with you. this is better solution. Can i open a new PR for this issue according to your suggestion?

5evki avatar Nov 23 '22 10:11 5evki

Hey @omeraplak , I agree with you. this is better solution. Can i open a new PR for this issue according to your suggestion?

Yes, please :)

omeraplak avatar Nov 23 '22 10:11 omeraplak