Support » Plugin: Email Subscribers & Newsletters » woocommerce integration

  • Resolved axelthedon

    (@axelthedon)


    Hello. I have a problem. I want to integrate this plugin with woocommerce platform. How can i show a checkbox with “Subscribe to Newsletter” to the checkout page? Can you please assist me?

    THanks.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • @axelthedon

    You may have to custom code it on your end. It would not be directly possible as of now.
    Do let me know if you need any help further.

    Plugin Author Icegram

    (@icegram)

    @axelthedon ,

    We have taken a note of this feature and we will add it in later releases.

    adryyy

    (@adryyy)

     /**
     * Add checkbox field to the checkout
     **/
    
    add_action('woocommerce_checkout_after_terms_and_conditions', 'my_custom_checkout_field');
     
    function my_custom_checkout_field() {
       ?>
       <div id="field-publicitate">
    		<p class="form-row input-checkbox" id="check_publicitate_field" data-priority="">
    		<span class="woocommerce-input-wrapper"><label class="checkbox ">
    			<input type="checkbox" class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" name="check_publicitate" id="check_publicitate" value="1"> Doresc să primesc mesaje publicitare și de marketing.</label>
    		</span>
    		</p>
    	</div>
       <?php
    }
    /**
     * Update the order meta with field value
     **/
    add_action('woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta');
     
    function my_custom_checkout_field_update_order_meta( $order_id ) {
        if ($_POST['check_publicitate']){
    		
    		$subs_email = esc_attr($_POST['billing_email']);
    		$subs_name = esc_attr($_POST['billing_last_name']);
    	
    		$form['es_email_name'] = $subs_name;
    		$form['es_email_mail'] = $subs_email;
    		$form['es_email_group'] = "Subs";
    		$form['es_email_status'] = "Confirmed";
    		$form['es_nonce'] = wp_create_nonce( 'es-subscribe' );
    		$action = es_cls_dbquery::es_view_subscriber_ins($form, "insert");
    	}
    }

    Use this in functions.php

    • This reply was modified 12 months ago by  adryyy.
    • This reply was modified 12 months ago by  adryyy.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘woocommerce integration’ is closed to new replies.