question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Shopping: Prevent duplicate products on a page

See original GitHub issue

Feature Description

Right now the idea is that a single product can only appear on a page once.

Currently, it’s possible to end up with multiple products by duplicating or pasting elements.

How can we avoid that?

Possible options:

  • Do not add element and display a snackbar message
  • Add the element but without the product attached

Not sure where’s the best place to do this.

Relevant code:

  • useCanvasCopyPaste: handles keyboard cop/paste
  • useCanvasKeys: handles element duplication via mod+d.
  • duplicateElementsById reducer
  • useAddPastedElements hook

Alternatives Considered

Additional Context

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

1reaction
swissspidycommented, Jun 8, 2022

but if I add 2 or more products and select them all at the same time, copy and try to paste them, I only see the message for 1 of the products (the last one that was added). What should we do in this case? Please see video below.

I knew you were going to ask this 😃

AFAIK this is currently expected behavior since this is how our snackbars work. We would need to revisit this in a separate ticket.

To answer your question:

  • Should we leave it as it is right now? yes
0reactions
felipebochehin87commented, Jun 8, 2022

Oh I’m so predictable! haha Thanks @swissspidy Approving this one and creating a new one to cover the “multiple products selected” scenario, which is:

#11654

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Advice: Duplicate Content on Product & Category Pages
John Mueller of Google offers insights on how Google handles duplicate content on product and category pages.
Read more >
How to Handle Duplicate Product Content - Sales Layer Blog
Duplicate content can be damaging for ecommerce businesses. Discover how to identify any cases of duplication and the steps to take to fix ......
Read more >
Hide duplicate product from shop page - WordPress.org
Hello, I need help to hide duplicate product. When different vendor add same product, it shows on shop page and other pages.
Read more >
Multiple listings for the same product - how to avoid duplication?
Hi everyone, We are working on an e-commerce site that has three different physical stores that each hold different products in stock.
Read more >
Prevent Duplicate Items from Being Added to a Shopping Cart ...
The old solution used JavaScript to store the items into a shopping cart cookie. Once done, the customer would be brought to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found