• Resolved soou2

    (@soou2)


    I want mark product featured by id using code

    i tried this code but not working

    // Your Product ID
    $product_id   = 43706;
    $ecd_product  = new WC_Product( $product_id );
    if( $ecd_product->exists() ){
        $ecd_product->set_featured( true );
        $ecd_product->save();
    }

    and tried this not working

    $product_id = 43706;
    $ecd_product = new WC_Product( $product_id );
    if( $ecd_product->exists() ){
    update_post_meta( $ecd_product->id, '_featured', 'yes' );
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘How Can Mark Product Featured WooCommerce using php code’ is closed to new replies.