• Resolved Luca

    (@screenload)


    Hey guys,

    is it possible to create a product with a specific id via php?
    I’m not talking about the SKU. We need to give the products a specific ID because we have to identify them in our ERP ??

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support con

    (@conschneider)

    Engineer

    Hi there,

    I would probably try and make use of a custom field for this. Similar to what is outlined here: https://www.remicorson.com/mastering-woocommerce-products-custom-fields/ – once you have a designated place to store the data as product meta you can use this in your function as well.

    Kind regards,

    Thread Starter Luca

    (@screenload)

    Ah okay, I already have some custom fields.
    Is it possible to store data into these fields when creating the product?
    Like this:

    $data = [
    	'name' => 'fancy name',
    	'type' => 'simple',
    	'regular_price' => '0',
    	'my_custom_field' => 'some id'
    ];
    • This reply was modified 6 years, 7 months ago by Luca.
    Thread Starter Luca

    (@screenload)

    It worked.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘import_id when creating products via PHP’ is closed to new replies.