Reward points plugin
-
I am trying to use the Wholesale plugin with a Reward plugin. The reward plugin is using the price to calculate the reward points. The calculated reward points are displayed in multiple places on the website. Unfotrunately some places display the reward points using the normal price some places the wholesale price as a base. The Reward plugin author is asking whether there is a price caching is activated in the Wholesale plugin?
-
Hi @tanlaci ,
We have a price caching feature but it’s only available for the Premium version of our plugin, see: https://prnt.sc/WIZ2EUSuvx8M
So, if you are a premium user, please disable it and check if the issue is fixed. If you are a free user then it’s likely a partially compatible plugin or caching from somewhere else, like:
- Plugin caching
- Server caching (reach out to your host provider to check and disable)
Let me know if you have other questions.
Cheers,
Hi there,
we are the authors of the plugin: https://codecanyon.net/item/woocommerce-reward-points/29123909 (sold over 800 times).
We use standard function: wc_get_price_to_display to get the price for point calculation. However your plugin does not seem to hook into any of these functions or woocommerce_product_get_price.
You just use “get_price_html” and add a text behind the product with the wholesale price. Is there any way to get your wholesale price with a hook or something? Or do you plan to follow WC default hooks?
hi @welaunchio ,
You can use the following parts of the to get the wholesale price of the product
global $wc_wholesale_prices; global $product; $productID = $product->get_id(); $wholesale_roles = $wc_wholesale_prices->wwp_wholesale_roles->getAllRegisteredWholesaleRoles(); // loop through wholesale roles foreach( $wholesale_roles as $wholesale_role => $data ) { // get wholesale price of product per wholesale role $wholesale_price_data = WWP_Wholesale_Prices::get_product_wholesale_price_on_shop_v3($productID, array( $wholesale_role ) ); $wholesale_sale_price_data = WWPP_Wholesale_Prices::get_product_wholesale_sale_price($productID, array( $wholesale_role ) ); // category level wil output 'product_category_level', per product is 'per_product_level'. general is 'wholesale_role_level' $wholesale_price_source = $wholesale_price_data[ 'source' ]; // wholesale price $wholesale_price = $wholesale_price_data[ 'wholesale_price' ]; }
Here’s an example output: Screenshot by Lightshot (prnt.sc)
Let us know if you need anything else.
Thanks for your request but I get errors:
- Fatal error: Class WWPP_Wholesale_Prices not found (maybe wwpp -> wwp)
- I tried WWP_Wholesale_Prices::get_product_wholesale_sale_price but then I get “method not found error”
- Commented it out and I get an empty array, no wholesale prices: https://imgur.com/a/AItcs0t
- I need the 474 price
We use this hook: woocommerce_after_shop_loop_item
Sorry about that, I’ve accidentally included our premium plugin’s function which resulted to errors.
Please use this
add_action('woocommerce_after_shop_loop_item','test'); function test(){ global $wc_wholesale_prices; $currentUserRole = $wc_wholesale_prices->wwp_wholesale_roles->getUserWholesaleRole(); global $product; $productID = $product->get_id(); $wholesaleProduct = WWP_Wholesale_Prices::get_product_wholesale_price_on_shop_v3( $productID, $currentUserRole ); $wholesalePrice = $wholesaleProduct['wholesale_price']; echo $wholesalePrice." Coded price goes here"; }
Output: Screenshot by Lightshot (prnt.sc)
Please note that if you are not seeing the same result as my screenshot, I suggest running some basic debugging to check for conflicts: How To Conduct A Basic Debug For Wholesale Suite – Wholesale Suite (wholesalesuiteplugin.com)
Hi there,
I disabled all plugins, used default theme and even just put your code into the functions.php (not our plugin), but it still not works: https://imgur.com/a/XIrglHu
On single products a fatal error is also triggered now.
Can you contact us via email to [email protected] then I can send you credentials? We would really like to add support for your wholesale plugin to our reward points plugin.
hi @welaunchio ,
Please give this code a try, it’ll only return the wholesale price of the product.
global $wc_wholesale_prices; $user_wholesale_role = $wc_wholesale_prices->wwp_wholesale_roles->getUserWholesaleRole(); $wholesale_price = WWP_Wholesale_Prices::get_product_wholesale_price_on_shop($product->get_id(), $user_wholesale_role);
If that doesn’t work, then I’m afraid we’ll need to raise an integration request with our developers. We also are not able to assist from here as this is outside our support scope.
Let us know if you have other questions.
Regards,
Sorry but with this code I get an empty string: https://imgur.com/a/LUaFqVj
Can you contact us at [email protected] and we send you admin / FTP data? Or our plugin?
We did not buy your plugin, but want to add support for our plugin.
Hi @welaunchio, would be great if you could write in via our support form with more information ??
https://wholesalesuitepugin.com/support/Since you’re attempting to integrate your plugin, Jeff provided the two code options above. You can use this to fetch the wholesale price data for a product/role combination.
get_product_wholesale_price_on_shop will return just the wholesale price data. get_product_wholesale_price_on_shop_v3 will return an array containing the wholesale price (with tax), the wholesale price (without tax) and the raw value.
You’ll need to process the response in your code before echoing.
If you write in, it would be great if you could provide more context about what you’re attempting to do with the data. I’ll close this thread off for now and looking forward to hearing from you.
I submitted a ticket now. Ticket text:
Hello,
we refer to this thread: https://www.ads-software.com/support/topic/reward-points-plugin/
We are the developers of a reward points plugin with over 1000 installs and want to add support for your plugin.
We need the wholesale price to calculate points, but NONE of the code, that was provided in the WP thread worked. Please send us a WORKING code to get the correct wholesale price.
Image below shows: empty string (no price returned): https://imgur.com/a/A88oFZt
Code used:
add_action('woocommerce_after_shop_loop_item', function() { global $product, $wc_wholesale_prices; $user_wholesale_role = $wc_wholesale_prices->wwp_wholesale_roles->getUserWholesaleRole(); $wholesale_price = WWP_Wholesale_Prices::get_product_wholesale_price_on_shop($product->get_id(), $user_wholesale_role); echo 'Wholesale price: ' . var_dump($wholesale_price); });
- The topic ‘Reward points plugin’ is closed to new replies.