{"id":3426,"date":"2014-11-28T13:29:37","date_gmt":"2014-11-28T02:29:37","guid":{"rendered":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/?p=3426"},"modified":"2025-01-13T03:28:57","modified_gmt":"2025-01-12T16:28:57","slug":"running-additional-tasks-after-a-sale-via-the-simple-cart-plugin","status":"publish","type":"post","link":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/running-additional-tasks-after-a-sale-via-the-simple-cart-plugin-3426","title":{"rendered":"Running Additional Tasks After a Sale via the Simple Cart Plugin"},"content":{"rendered":"\n<p>You can run some additional tasks after&nbsp;the <a href=\"https:\/\/wordpress.org\/plugins\/wordpress-simple-paypal-shopping-cart\/\" target=\"_blank\" rel=\"noopener\" title=\"\"><strong>simple cart plugin<\/strong><\/a> has processed a sale.<\/p>\n\n\n\n<p class=\"has-background\" style=\"background-color:#ffedbd\"><strong>Note: This should only be tried by a developer as it involves custom PHP coding.<\/strong><\/p>\n\n\n\n<p>The plugin includes action hooks that are triggered after the checkout data is processed. These hooks allow you to perform additional custom tasks. Below is a code snippet demonstrating how to use one of these action hooks.<\/p>\n\n\n\n<p>You can add this code to the <code>functions.php<\/code> file of your theme or to a custom plugin.<\/p>\n\n\n<h2 class=\"simpletoc-title\">Table of Contents<\/h2>\n<ul class=\"simpletoc-list\">\n<li><a href=\"#paypal-commerce-platform\">PayPal Commerce Platform<\/a>\n\n<\/li>\n<li><a href=\"#paypal-standard\">PayPal Standard<\/a>\n\n<\/li>\n<li><a href=\"#stripe-checkout\">Stripe Checkout<\/a>\n<\/li><\/ul>\n\n<h2 class=\"wp-block-heading\" id=\"paypal-commerce-platform\">PayPal Commerce Platform<\/h2>\n\n\n<p>Here is example code if you are using the PayPal Commerce Platform (PPCP) checkout option.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">add_action('wpsc_paypal_checkout_ipn_processed', 'wpsc_custom_post_payment_tasks');\nfunction wpsc_custom_post_payment_tasks($ipn_data)\n{\n    \/\/You can write the $ipn_data array's content to a file.\n    $firstname = $ipn_data['first_name'];\n    $lastname = $ipn_data['last_name'];\n    $email = $ipn_data['payer_email']\n    \/\/TODO - Do something with the data\n}<\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"paypal-standard\">PayPal Standard<\/h2>\n\n\n<p>Here is example code if you are using the standard PayPal checkout option.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">add_action('wpsc_paypal_ipn_processed', 'wpsc_pp_ipn_tasks');<br>function wpsc_pp_ipn_tasks($ipn_data)<br>{<br>    \/\/You can write the $ipn_data array's content to a file to see<br>    \/\/what paypal sends in the IPN<br>    $firstname = $ipn_data['first_name'];<br>    $lastname = $ipn_data['last_name'];<br>    $email = $ipn_data['payer_email']<br>    \/\/Do something with the data<br><br>}<\/pre>\n\n\n\n<p>The PayPal IPN message&nbsp;consists of variables and is&nbsp;available as an array inside your&nbsp;function. You can access an element of the array by using the proper variable name. To see a list of all the available variables&nbsp;please check the <a href=\"https:\/\/developer.paypal.com\/docs\/classic\/ipn\/integration-guide\/IPNandPDTVariables\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">PayPal IPN documentation<\/a> page.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"stripe-checkout\">Stripe Checkout<\/h2>\n\n\n<p>Here is example code if you are using the Stripe checkout option.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">add_action('wpsc_stripe_ipn_processed', 'wpsc_stripe_post_payment_tasks');<br>function wpsc_stripe_post_payment_tasks($ipn_data)<br>{<br>    \/\/You can write the $ipn_data array's content to a file.<br>    $firstname = $ipn_data['first_name'];<br>    $lastname = $ipn_data['last_name'];<br>    $email = $ipn_data['payer_email']<br>    \/\/TODO - Do something with the data<br>}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>You can run some additional tasks after&nbsp;the simple cart plugin has processed a sale. Note: This should only be tried by a developer as it involves custom PHP coding. The plugin includes action hooks that are triggered after the checkout data is processed. These hooks allow you to perform additional custom tasks. Below is a [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[30],"tags":[196,173,24,32],"class_list":{"0":"post-3426","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-wordpress-shopping-cart","7":"tag-code-example","8":"tag-e-commerce","9":"tag-tweaks","10":"tag-wp-shopping-cart","11":"entry"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/posts\/3426"}],"collection":[{"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/comments?post=3426"}],"version-history":[{"count":0,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/posts\/3426\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/media?parent=3426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/categories?post=3426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/tags?post=3426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}