• Resolved mstudioeu

    (@mstudioeu)


    Hey team, I hope you’re well.

    I wanted to check something – is there a way to ensure sequential IDs for products or at least be able to choose a number range for IDs?

    My case is the following: I worked on a small e-shop where I uploaded the products manually one by one. Each product got assigned a random ID automatically by WooCommerce, ranging from 100 to 400 and even 1000.

    Now I want to upload a large amount of products using a .csv sheet and I am not sure how to avoid the issue of having the newly uploaded products take the IDs of an already existing product and therefore overwrite the existing product.

    This already happened and while I am going to fix it now, I was just wondering if there’s a way to avoid this in the future. Thank you in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Stef

    (@serafinnyc)

    Hello @mstudioeu Unfortunately, WooCommerce product IDs are based on the post IDs used by WordPress. In WordPress, WooCommerce products are stored as a custom post type (‘product’), so they share the same ID system as posts and pages. This means that each product ID is a post ID in the WordPress database, and they are generated in the same sequence as other WordPress content types.

    To ensure that only WooCommerce product IDs are sequential, you would need to separate their ID generation process from other post types. One way to achieve this is by creating a custom table for products and managing the ID generation manually. However, this approach can be complex and may affect the compatibility with WooCommerce and other 3rd party apps and future updates.

    There might be a 3rd party app out there that already does this, but I myself am not aware. Otherwise, you’ll need a developer who can code something for you in order to import products thru CSV and ensure they are in sequential order.

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi @mstudioeu,

    Just to add on what community member @serafinnyc has already shared.

    When importing products with a CSV, WooCommerce does not overwrite existing products by default. The CSV Importer has a column called ‘ID’ which is used to match the product in the CSV to an existing product on your site. Hence, you should avoid using the ‘ID’ column unless you’re intending to update existing products.

    To prevent overwriting, you can use a unique identifier for each product, such as the SKU. If the SKU is defined in the CSV, the importer will use it to identify if the product is new or existing. If you don’t want to use SKUs, you can leave the ‘ID’ column blank when creating new products, and WooCommerce will automatically assign a new, unique ID.

    More details can be found from the general guidelines when creating a CSV.

    I hope this information helps you. If you have any other questions or need further assistance, feel free to ask.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.