New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate SKUs are possible #5712

Closed
javorszky opened this Issue Jun 20, 2014 · 9 comments

Comments

Projects
None yet
7 participants
@javorszky
Contributor

javorszky commented Jun 20, 2014

While I can not set the same SKU for the same simple or virtual product (that have post_type: product, I can set the same SKU for a simple product, and a variation on another product. Moreover I can set the same SKU on two different variations of the same product. Screenshot is after save.
screen shot 2014-06-20 at 16 19 39

And they live happily with this:
screen shot 2014-06-20 at 16 20 50

Current version is 2.1.11, what's on the WP plugin repo, and WP 3.9.1

@coenjacobs

This comment has been minimized.

Contributor

coenjacobs commented Jun 21, 2014

I can think of use cases where this might be expected behaviour. Variations don't necessarily require a product to be completely different, therefore duplicate SKUs might be required.

@mikejolley Can you confirm wether or not this is intentional? If not, this is a simple patch, as the same validation done on non-variation products can be applied on variation products.

@javorszky

This comment has been minimized.

Contributor

javorszky commented Jun 21, 2014

I'd argue that since this is the definition of SKU,

SKU refers to a stock keeping unit, a unique identifier for each distinct product and service that can be purchased in business.

all SKUs should be unique across the board.

@rmx101

This comment has been minimized.

rmx101 commented Mar 18, 2015

I notice it's possible to create simple and/or variable products with same SKU# by duplicating a simple or variable product and publishing. However "add" new product does not allow duplicate SKU. Duplicating product seems to allow same SKU.

@lkraav

This comment has been minimized.

Contributor

lkraav commented May 12, 2015

I'm posting variable products via API on 2.3.8.

  1. No API error is generated when posting multiple duplicate SKUs for products with no variations, i.e. going into draft mode.
  2. On top, 2.3.8 allows the manager to go into admin and publish all products with duplicate SKUs with nothing stopping it.

This doesn't look right or am I missing something?

Does it make sense to reopen this bug or file a new one?

@lkraav

This comment has been minimized.

Contributor

lkraav commented May 24, 2015

2.3.9

PUT request including variations with existing duplicate variation SKUs passes with no errors.

https://github.com/woothemes/woocommerce/blob/master/includes/api/class-wc-api-products.php#L1271 for the uniqueness check is for some reason put behind a sanitization conditional. Shouldn't uniqueness verification be run always?

@SynapsisIT

This comment has been minimized.

SynapsisIT commented Mar 21, 2016

I disagree with this decision, there are cases where duplicate SKU is necessary. Here is a scenario that i've recently stumbled upon where duplicate SKU is required;

My client has a product for Autos, these products require kits to be implemented, where each kit has its own sku and is made for a specific auto model, there are however cases where a kit is perfectly fine with multiple car models. So what we do is, sell "Product 1" and define as variations the names of the car models to determine the car model for which the customer needs the kit (note, client doesn't sell separately the product from the kits, hence we need to determine the car model so we can ship the right kit for the product). At this point, by closing the duplicate SKU's we cannot do that on the same product.

More over, we cannot do that even on a different product. Because if "Product 1" was made of steel and we have "Product 2" made of carbon fiber, where both products do share a large part of the kits (since kits are made for specific auto models, in most cases the kits remain attached to the car models but may or may not fit for the same products) we cannot add these kits as variations to determine the car model of the customer and therefor determine the right kit to send over.

There should be a way that allows us to chose whether we do want to allow duplicate SKU's or not. Overriding the core woocommerce files to simply allow duplicate SKU's because as for me, i believe for many others, is a must is not the way to go. I cannot force my client to change his mind after 30 years he has had his offline business and rename 1000s of products SKU's just because someone doesn't think of all other possibilities but "solves" his own single problem. A little bit of flexibility and options of choice will do no harm.

@mikejolley

This comment has been minimized.

Member

mikejolley commented Mar 21, 2016

@SynapsisIT SKU is used in many places as a 'unique' ID. e.g. for product CSV imports. Dupe skus would break this.

Why not code a new custom field for your duplicate SKUs and not use core SKUs - they your change doesn't require core edits, and it won't break the system for other users.

@SynapsisIT

This comment has been minimized.

SynapsisIT commented Mar 21, 2016

@mikejolley In fact, the kits do have their unique SKU, the problem arises when these kits need to be assigned in different products as their extension.

However the custom fields route does make sense as I am not keen to modify core files, even tho it implies modifying many other things (like attaching the custom field to the order detail so my client can easily determine the kit's SKU chosen). But it definitively sounds like a work around solution. Thanks for the idea.

@KaiWilliams

This comment has been minimized.

KaiWilliams commented Apr 21, 2017

Our SKU fields correspond to a product's unique Salesforce ID which allows us to use WooCommerce Zapier to flow data into our database this has been working great but now we've added an ebook variation to a product that has its own SKU. The product has two variations - one is purely about price and asks if someone is a member to provide the appropriate pricing variation, the second variation is softcover or ebook (needing the different SKU). So I have 4 variations of the product and want 2 to have the softcover book SKU and 2 to have the ebook SKU so I can track appropriately in my database. Right now 3 of the variations will flow from the product SKU and I can have 1 variation with a separate SKU. Any way I can make this 2 and 2?

https://theiwrc.org/product/iwrc-book

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment