Ecommerce Shopify WordPress Discussion

woocomerce plugin to send request upon payment/purchase

ive written a plugin (its just a php file in folder in the plugins folder) tht is supposed to send some info to flask app, but at the moment nothng is happening when i do a test order usin g a 100% coupon code, also hen i ctivte the plugin i get the error: The plugin generated 1 character of unexpected output during activation. If you notice “ headers already sent ” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin. what am i doing wrong <?php /* Plugin Name: woopostreq Description: Custom actions for WooCommerce. Version: 1.0 Author: callum */ add_action( 'woocommerce_payment_complete', 'so_payment_complete' ); function so_payment_complete( $order_id ){ $order = wc_get_order( $order_id ); $billing_email = $order->get_billing_email(); $billing_phone = $order->get_billing_phone(); $order_date = $order->get_date_paid(); $url = 'http://blanked out/woocommercepost'; // Add 'http://' to the URL // Prepare the data for the request $data = array( 'orderid' => $order_id, 'billingemail' => $billing_email, 'billingphone' => $billing_phone, 'orderdate' => $order_date ); // Post the request wp_remote_post( $url, array( 'method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => $data // Pass data using 'body' parameter )); }
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.