Trigger to Award GamiPress (Points/Badges/Ranks) on visiting WooCommerce Products/Specific Products

It’s very common to award GamiPress points/badges/ranks on users’ visit at any page on GamiPess site according to its default achievement system and surely there isn’t any option to award points/badges/ranks on visiting custom post-type posts only, but how amazing it is, if you eagerly like to add this feature simply to GamiPress and experience it.

All the snippets below will be used for WooCommerce “Product” post-type. As an example. Users will be getting points/badges/ranks on visiting WooCommerce products or specific product pages.

Note: GamiPress and WooCommerce plugins must be configured in order to use these snippets.

Let’s Check it now;

Snippet 1: Add new trigger to the gamipress

This snippet will add a new trigger (heading) to GamiPress as rest of the default triggers shown in drop down.

Copy to Clipboard

Snippet 2: List WooCommerce Products to the trigger

This snippet will easily list all the WooCommerce products to the triggers.

Copy to Clipboard

Snippet 3: Title for sub trigger

This snippet will be used to display label on GamiPress activity log.

Copy to Clipboard

Snippet 4: Award Points/Badges/ranks

This snippet will award points/badges/ranks to WooCommerce/specific products on visiting it.

Copy to Clipboard

Conclusion

So, All you need to add this code snippet to your theme functions.php file to award points/badges/ranks on visiting custom post-type posts only.

Enjoy!

Farooq Abdullah

Web Developer

Farooq Abdullah is a professional Web Developer having more than 6 years of working experience in different PHP platforms especially WordPress. He is bachelors in computer science and he has also developed many plugins, add-ons and code snippets to facilitate others.

Sign up to our Newsletter

(We do not share your data with anybody, and only use it for its intended purpose)