• Resolved Noelle Steegs

    (@noellesteegs)


    Hi,

    I have already disabled the unique SKU check with:

    add_filter( 'wc_product_has_unique_sku', '__return_false' );

    But unfortunately this does not apply to the native importer. Is there a snippet that I can use to ensure I can import products with the same SKU?

    Thank you. ??

    • This topic was modified 4 years, 4 months ago by Noelle Steegs.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support mouli a11n

    (@mouli)

    Hi there,
    Interesting question!
    The default is certainly for it to check for a unique SKU and without it the importer does not know whether a product already exists and needs to be updated.

    The column schema for the default CSV importer is seen here:
    https://github.com/woocommerce/woocommerce/wiki/Product-CSV-Import-Schema#csv-columns-and-formatting

    SKU is required and will cause issues if it is the same for multiple products and the importer will see them as the same product.

    Maybe if you can explain a bit more about why you need identical SKUs we might find a workaround.

    Thread Starter Noelle Steegs

    (@noellesteegs)

    Hi @mouli,

    Thanks for your response. ??

    Yes, I fully understand why its default dehaviour is like this. However, in this case I actually need the importer to view products with the same SKU as the same product. I am looking for an initial import only and won’t need to update the products.

    My client has a product in 3 main sizes = 3 SKUs for his order fulfillment software. I am setting up a type of form where customers have to provide measurements and the confirmation page will contain an add to cart button (Woo shortcode) based on their measurements. The catch is that, based on the measurements, there may or may not be extra parts that are sent (but the customer doesn’t need to know about this). So honestly in reality there are maybe 30 products. But having different SKUs for all of them would mess with order fulfillment, says client. Because the order fulfillment company only sends the main products and he himselfs ships the extra parts.

    But as I am typing this an idea pops up – would it be possible to have an add to cart button that includes the right variation? And would that variation then require to have an SKU code? If no SKU is entered for the variation, would Woo then pass on the parent SKU to the order fulfillment company (Odoro)?

    Do I understand correctly that there is no PHP filter available that will disable the SKU check for the product importer?

    Thanks so much!

    Plugin Support mouli a11n

    (@mouli)

    Yes you can create an Add to Cart button link that includes the variation as follows:

    https://yoursite.com/cart/?add-to-cart=555&variation_id=666&attribute_pa_attribute-slug=attribute-value

    where
    555 is the product ID found under the product title in the All Products page:


    Link to image: https://d.pr/i/SmD2WL

    and 666 is the variation ID found under the Variations tab in the product editor:


    Link to image: https://d.pr/i/7fBe2t

    attribute_pa_attribute-slug is the attribute slug with a prefix of attribute_pa_. You can find the attribute slug under Products ? Attributes:


    Link to image: https://d.pr/i/oaNscY

    and attribute-value is the attribute value slug which is found when you click the configure terms link under Products ? Attributes:


    Link to image: https://d.pr/i/KTuD6w

    That will create a link that will add the variation to the cart with out any SKU involved.

    “Do I understand correctly that there is no PHP filter available that will disable the SKU check for the product importer?”

    The schema for the default importer can be found here:
    https://github.com/woocommerce/woocommerce/wiki/Product-CSV-Import-Schema#csv-columns-and-formatting
    indicates that the SKU is required and it does need to be unique.
    I tested this on my own site and it rejected a duplicate SKU so there is no easy way around this issue.

    I hope that helps you to figure it out.

    • This reply was modified 4 years, 4 months ago by mouli a11n. Reason: typos
    Thread Starter Noelle Steegs

    (@noellesteegs)

    Hey @mouli,

    I’ll create variations manually instead of via an import – because when I do it manually, an SKU isn’t required but when I import it is. And I see that when I do this, no SKU is created for the variation and the SKU of the parent product is in the order, which is exactly what I want. ??

    I’ll then use this shortcode to create an add to cart button for a variation, based on the product ID. I tested this and it works like a charm!

    Thanks again for your help – with variations instead of products the result will definitely be neater.

    Plugin Support mouli a11n

    (@mouli)

    Hi Noelle,
    Great that you found a solution that worked for you.
    The importer does indeed require an SKU in order to check for duplicates and identify a Parent product etc.

    I will close this ticket as solved for now, but if you ever need further assistance, feel free to get back to us.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Disable SKU check for importer’ is closed to new replies.