Tags/topics: 
3
Answers
Vote up!
3
Vote down!

How do I give customer option to share their purchase on facebook on receipt page?

Hi-

Thank you so much for drupal commerce.

Sorry if the answers to my questions are obvious - I have searched this site several times for facebook and only find links to social login.

How do I give customers the option to share their purchase on facebook on the receipt page post-purchase?

1. Ideally I'd like to do what Amazon does on the receipt page where the customer gets to post a pre-configured message to their facebook account.
2. Also ideally, I'd like to give them the option without having to install social logins on my site.
3. If default options pushes "I just purchased (product name)" to facebook, great. But would be nice to be able to customize what gets pushed, like instead of "I just bought T-Shirt" would be even better if it was "I just bought Large T-Shirt at xyz.com"
4. If same module makes it easy to push same text to twitter or google plus/other social media, all the better.

Thanks in advance!

-Michael

Asked by: luckydad
on September 7, 2013

3 Answers

Vote up!
2
Vote down!

Ok guys! Here's my thoughts on this:

While the architecture provides plenty of places for this to happen, there isn't a straightforward way to do it.

My next reaction is, we can definitely do this with the messages module (comes with Kickstart 2) and some sort of "use rules to send social messages" service ... like this module here: https://drupal.org/project/rpx

Also, there are a number of "share widgets" that accept tokens ... https://drupal.org/project/sharemessage and it would simply be a matter of creating your own custom token based on the current user id.

Upon a bit more inspection, I think the recommended approach would be to use Messages and create a Message Notify service that integrates with your favorite social service (twitter, facebook, linked-in, instagram, etc). If money and time are at stake, then one of the above strategies would be faster and potentially easier, but less flexible.

STEP BY STEP

1) Create a new Message Type called "Social Share"
Make sure to include the tokens you want in your message. If you want "I bought [product abc] at [mywebsite]" then you will need to create a message per product line item type that is in your cart. These tokens can be passed from rules into messages without the need to create a custom token using code.

2) Create a rule that actually creates the message entity of type "Social Share"
The trick is knowing how to create a rule that can loop around the list of line items in a cart, and then how to add a second rule that gets fired from within that loop that actually generates the messages.

3) Make sure you have a way to generate share links/icons
Now that you have messages being generated per customer per product, you have two options. A) You could create a new "Message Notify" service that posts these messages to a service provider (most flexible, also a daunting developer task). B) You could look into one of the many social modules/services out there that let you set up links with a custom title. One such service that we've recommended in the past is "ShareThis" and they have a nice examples page that gives you lots of cut & paste options.

4) Put the share buttons on your checkout completion page.
One of the easiest ways to do this in code is to use the hook_form_alter() function.

<?php
function example_form_commerce_checkout_form_complete_alter(&$form, &$form_state) {
 
$form['checkout_completion_message']['message'] = '<pre>add button text or rendered message entities wrapped in sharethis links here.</pre>';
}
?>
Josh Miller
Answer by: Josh Miller
Posted: Mar 13, 2014
Vote up!
0
Vote down!

I have the same requirements from my client...

Any updates / project on this?

Answer by: Nachtraaf
Posted: Feb 2, 2014
Vote up!
0
Vote down!

I have the same requirement. Could somebody post an answer if you know? :-(

Answer by: svikashk
Posted: Mar 13, 2014