Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @roghithsam !

    Could you please elaborate more on what you are trying to do?

    Please provide us with more details so we can assess this issue in a better way. Feel free to provide screenshots if you feel that helps to illustrate it better.

    You can use https://snipboard.io for sharing screenshots – please follow the instructions on the page, then paste the URL in this chat. It works with Chrome, Firefox, Safari, and Edge.

    Looking forward to hearing from you!

    Thread Starter roghithsam

    (@roghithsam)

    the code i used for custom field

    add_action( 'woocommerce_product_options_advanced', 'ws_adv_product_options');
    function ws_adv_product_options(){
    	echo '<div class="options_group">';
    woocommerce_wp_text_input( array(
    		'id'                => 'winner_select',
    		'value'             => get_post_meta( get_the_ID(), 'winner_select', true ),
    		'label'             => 'Winner Name'
    	) );
    	echo '</div>';
    }
    
    add_action( 'woocommerce_process_product_meta', 'ws_save_fields', 10, 2 );
    function ws_save_fields( $id, $post ){
     
    	if( !empty( $_POST['winner_select'] ) ) {
    		update_post_meta( $id, 'winner_select', $_POST['winner_select'] );
    	} else {
    		delete_post_meta( $id, 'winner_select' );
    	}
    }

    If the winner’s name is entered in the field and the product is updated. A mail should be sent to all users who have previously purchased the product

    mail content
    Subject: Lucky Winner Selected for [product name]
    message: some text [winner name]

    • This reply was modified 3 years, 3 months ago by roghithsam.
    • This reply was modified 3 years, 3 months ago by roghithsam.

    Since this requires custom coding, I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    For additional assistance on this topic, we recommend getting in touch with one of the customization experts listed on the WooCommerce Customizations Page.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers!

    This thread has been inactive for a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘email when meta value change’ is closed to new replies.