• Resolved WP Ninja

    (@sameernxb)


    Hi,

    We are planning to integrate a new feature which is to add the abandon checkout users email to our mailchimp list which we maintain. For that we are using the web hook where we have added a URL as shown below. We are assuming that once the user abandon the checkout your plugin will post data on that added URL which is below.

    https://takiwatches.com/?process-webhook=1

    Can you please tell us how we can get posted data. Should we use wp_remote_get function any help will be greatly appreciated. Our code same is as follows.

    function process_abandon_webhook(){
    		if( isset( $_GET['process-webhook'] ) && $_GET['process-webhook'] == 1 ) {
    			// do some stuff get checkout data and add email to mailchimp.
    		}
    	}
    
    add_action( 'init', 'process_abandon_webhook');

    Looking forward to your response.

    Kind Regards,

    • This topic was modified 4 years, 6 months ago by WP Ninja.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support CartFlows Team

    (@cartflows)

    Hello @sameernxb,

    Thank you for reaching out to us.

    The plugin sends the data in the JSON format, so you need to parse it.

    You can use the wp_remote_get function to parse the data.
    Here is the doc for reference: https://pippinsplugins.com/using-wp_remote_get-to-parse-json-from-remote-apis/

    https://zapier.com/apps/email/integrations/mailchimp

    Let us know if you have any questions.

    Thread Starter WP Ninja

    (@sameernxb)

    Hi,

    Thank you very much for sharing the info.

    Actually we have tried using the wp_remote_get function but it do not works as we can’t see any data posted on the web hook URL we have added.

    It looks that data is posted on a certain hook execution or execute on a certain time and that is where we need to access the Abandon checkout user data. Currently we are firing a function on WordPress init hook and when we try to get data from the web hook URL it do not shows anything in the email. We are also sharing the sample code.

    Can you tell any specific hook or execution time when we should be able to get posted data on our email. Once we get the data we can do the rest of the work. Looking forward to your response.

    Thanks,

    function process_abandon_webhook(){
    		if( isset( $_GET['process-webhook'] ) && $_GET['process-webhook'] == 1 ) {
    			//Fetch Abandon Cart Plugin Posted Data
    			$web_url = get_option('wcf_ca_zapier_cart_abandoned_webhook');
    			$request = wp_remote_get( $web_url );
    			if( is_wp_error( $request ) ) {
    				return false;
    			}
    			$body = wp_remote_retrieve_body( $request );
    			$data = json_decode( $body );
    			if( !empty($data) ){
    				wp_mail('add your email','Abandon Cart Data',$data);	
    			}else{
    				wp_mail( 'add your email','Abandon Cart Data','No Abandon Cart Data' );	
    			}		
    		}
    	}
    
    	add_action( 'init', 'process_abandon_webhook', 10 );
    • This reply was modified 4 years, 6 months ago by WP Ninja.
    Plugin Support CartFlows Team

    (@cartflows)

    Hello @sameernxb,

    Webhook sends the data when any cart is abandoned or recovered. If you are using the init then it will call the function on every load and you will not get the data.

    The plugin triggers the webhook on the below hooks.
    woocommerce_new_order ,woocommerce_thankyou, woocommerce_order_status_changed.

    You can use the same hooks.

    Let us know if you have any questions.

    Thread Starter WP Ninja

    (@sameernxb)

    Hi,

    Thank you very much for help again.

    Current Plugin Workflow

    Probably it looks it is not linked with the above woocommerce hooks. As per your comment we are interested in the user cart abandoned scenario.

    It looks if the user has not placed an order for 15 minutes your plugin run a CRON job and execute that webhook. The function which we found which ensures that CRON is executed automatically after 15 minutes is update_order_status which also calls webhook trigger_zapier_webhookfunction which is responsible for posting data on the URL which we have added.

    Now CRON custom action hook which you are firing is cartflows_ca_update_order_status_action which runs the above update_order_status function and in that function it calls trigger_zapier_webhook webhook function.

    Our Workflow

    Even if we try to use the CRON action hook of your plugin cartflows_ca_update_order_status_action it do not post anything and we get no info of abandon user data from the plugin. Maybe in function update_order_status your plugin can expose a new hook in which that data is passed and we can use that to get all abandon info.

    It could be a valuable addition to the plugin. If there is a way to get info using that custom CRON hook then let us know. I think it might not work. We highly appreciate your help. Looking forward to your response.

    Kind Regards,

    • This reply was modified 4 years, 6 months ago by WP Ninja.
    • This reply was modified 4 years, 6 months ago by WP Ninja.
    Thread Starter WP Ninja

    (@sameernxb)

    Hi,

    We hope you are doing well.

    Can you add one hook as well. When you add abandon cart user info in the backend and at the same time fire web hook. Can you add one hook at that point which we can use. You can pass web hook data in that hook or at least an hook with which we can get the data of your plugin.

    Looking forward to your response.

    Thanks,

    Plugin Support CartFlows Team

    (@cartflows)

    Hello @sameernxb,

    Thank you for getting back to us.

    We will check it once and will add this task in our development queue accordingly.

    Let us know if you have any questions.

    Thread Starter WP Ninja

    (@sameernxb)

    Hi Cartflows,

    Thanks for considering it. I believe it will not be a complicated task. Only 1 hour job. You just need to pass the that abandon data using do_action after saving on the backend of plugin settings.

    Let us know when you will add action hook. The plugin will get more flexible and can be extended more easily.

    Best,

    Plugin Support CartFlows Team

    (@cartflows)

    Hello @sameernxb,

    We have added this task in our development queue.

    We will add this hook in our upcoming future updates.

    Let us know if you have any questions.

    Thread Starter WP Ninja

    (@sameernxb)

    Hi,

    Is there any update you just need to pass the abandon user cart data using do_action hook where you are running CRON and it will do the trick. It won’t take much time maybe 1 hour to test and update the plugin. We can do that as well but update will override the changes which we will do every time.

    The other issue is related to email not rendering images correctly in outlook. This is because of outlook ignores inline styles. Our suggestion in that case is to add image height and width attribute and it will fix the problem.

    Looking forward to your response.

    Best,

    • This reply was modified 4 years, 5 months ago by WP Ninja.
    • This reply was modified 4 years, 5 months ago by WP Ninja.
    Plugin Support CartFlows Team

    (@cartflows)

    Hello @sameernxb,

    As we said earlier, we are going to add this action in our next update.

    Regarding your second issue, our developers are working on this issue too.
    We will fix this issue and will release the update soon.

    Your co-operation and patience are much appreciated.

    Let us know if you have any questions.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Add Abandon User Email To Mailchimp’ is closed to new replies.