Skip to content

WP SocialDiscounts plugin allows WooCommerce websites to give visitors an automatic coupon for sharing the WooCommerce website

License

Notifications You must be signed in to change notification settings

itsDevKay/WP-SocialDiscounts

Repository files navigation

WP SocialDiscounts

What is WP SocialDiscounts

WP SocialDiscounts is a custom plugin solution that allows you as a owner of a WooCommerce website to allow your visitors to get a 10% discount by sharing your
website to their Facebook, Twitter, or Pinterest account.

How WP SocialDiscounts Works

WP SocialDiscounts works by placing the shortcode ['social_discounts'] where you want to display the shortcode on your WooCommerce website.

When the user clicks one of the social share buttons,

  • WP Social Discounts checks if the user already has a cookie in place. If a cookie is in place, the plugin will grab the value of the cookie and check it with the database to verify it is a valid coupon or if it's expired. If it is expired, a new cookie/coupon combo will be generated with a new expiration date.
  • If a cookie is not in place, a random 10 alphanumeric character will be generated and placed in the WordPress database under the wp_posts table with a post_type of shop_coupon with a 7 day expiration date.
  • That same randomly generated value will also be given as a value to a custom cookie given to the visitor who clicked a social share button. That cookie will stick with the user for 7 days in case the visitor decides to return to the website.
  • Once the cookie/coupon value is generated, when the visitor arrives at the checkout page, WP SocialDiscounts will read the cookie from the user's browser and apply the coupon in automatically in the checkout page for the user's convenience.

Current Limitations

Currently, this plugin is in working condition with no customization towards the look, social media options, and percentage discounts without changing the code.
WP SocialDiscounts has the database created upon installation of this plugin, but I have yet to utilize the conditions to customize these options.

Another issue to point out is that there is currently no way, to my knowledge and according to ShareThis, to verify that a user has actually shared the post and not just hit cancelled. Due to this lack of verification, a visitor can click a social share button and proceed to back out without sharing and receive the discount.

Luckily, if a visitor has a discount code already, they can not get another coupon without deleting their sd_social-discount-cookie and repeating the same process again.

Exploitations

As mentioned above in limitations regarding no verification to a user actually posting, a visitor upon finding out that this plugin works through cookies, can:

  • Click social share button
  • Cancel social post sharing
  • Receive %10 coupon
  • Open Developer Tools to log the generated coupon (assuming they know that is the coupon value)
  • Delete cookie
  • Repeat.

The Coupon is enabled in the code currently to allow stacking with other coupons generated by WooCommerce. This function will in the future become an optional tick through the customization options.

Future Updates

To allow dynamic uses for all users of this plugin I have setup an order for updates to be handled in order to make this plugin fully customizable to users.

  • Analytics Counter to view how many times a social share button was clicked.
  • Admin Panel back end for custimization options regarding, banner color, text color, discount percentage, banner header, banner subheader, page to share, and a checkbox to allow coupon stacking.

About

WP SocialDiscounts plugin allows WooCommerce websites to give visitors an automatic coupon for sharing the WooCommerce website

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published