Social Discounts - Usage/Modifications
The Social Discounts extension for Easy Digital Downloads has available filters, shortcodes, etc that can be used for a more customized experience.
.shared CSS class is added dynamically to the wrapping HTML div when a product is shared. This will allow you to style the “thanks” title and message to make it more obvious that the product was shared and the user should should add the product to their cart, or proceed to checkout.
The following filters are available to developers when the Social Discounts extension is activated:
With Social Discounts, by default the sharing buttons will be shown automatically after the content on all your products. By using the included shortcode you can fine tune the placement on a per product basis, or even include the sharing buttons on posts and/or pages.
The shortcode accepts an “id” parameter. This could be the ID another post, page or product. Extremely useful for when you want to share a product, from an entirely different page. If you want to share the current product/post/page that the shortcode is on, you do not need to include the ID parameter.
If you’re using the ID parameter above, chances are you’ll want to also customize the sharing title and message. You can use the “title” and “message” parameters like this:
[edd_social_discount id="50" title="Share my awesome product!" message="Share my awesome product and you'll receive a discount at checkout."]
Custom Tweet message:
[edd_social_discount tweet="This is a custom message for the twitter sharing button"]
Add Shortcode to Checkout
When a customer lands on your checkout page they have shown a desire in purchasing from you. This is a perfect opportunity to offer them a discount on their order in exchange for a social share with Social Discounts.
Although adding an ID parameter to the shortcode can share a specific post/page/download, if you don’t use the ID parameter, it will share the current page. This is not ideal in situations like this, where we want to share the site URL, not the URL to the checkout page.
This small code snippet will show you how to change the share URL conditionally, and share the site URL, not the checkout page.