• Hello !

    I want to create a script to create about a hundred of product with same caracteristics but different name that are stored in a data base.

    When I use the class WC_Admin_Duplicate_Product and the function product_duplicate() with a simple product, it works fine. But when I want to duplicate a variable product, it returns me an error 500.

    With some var_dump, it seems that the problem happen between the ‘return WC()->product_factory->get_product( $the_product, $deprecated );’ in the wc_get_product() function and the ‘$duplicate = wc_get_product( $duplicate->get_id() );’in the product_duplicate() function.

    I call the function like this :
    ‘ $template = wc_get_product(get_the_ID());
    $wc_adp = new WC_Admin_Duplicate_Product();
    $alphonse_product = $wc_adp->product_duplicate( $template );’

    Seeing var_dumps, it seems that $template is the correct product and is an instance of WC_Product_Variable.

    Do you have any idea of what I could have done wrong ?

    Thank you in advance,

    Regards

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Duplicate variable product’ is closed to new replies.