- This topic has 2 replies, 2 voices, and was last updated 4 years, 7 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Affiliates Management Plugin for WordPress
by
WordPress Affiliate Manager › Forums › Affiliate Manager Plugin › Show woocommerce product commission in the shop and product page
The plugin is great and solves all most of my problem as a dropshipping suppliers, good job
I purchased the Woocommerce product based commission, it is working fine, my question is
How to show the product commission in the shop page and in the product page, as I have different commission for each product and need my affiliates to be able to see the commission of each product
Thanks
@brandsload, our plugin doesn’t have an option to do this at the moment.
Well, I beleive you have to consider it, however, I did some researches and I did it, here is how you can do it
The product commission is stored in a woocommerce product custom field called “wpam_woo_product_specific_commission”
To display this field value in the products loop in shop and archive pages you need to add this function to your child theme functions.php
—–
add_action( ‘woocommerce_after_shop_loop_item_title’, ‘wpam_woo_product_specific_commission’, 35 );
function wpam_woo_product_specific_commission() {
global $post;
if ( is_home() || is_shop() || is_product_category() || is_product_tag() ) {
echo ‘<span class=”woocommerce-breadcrumb”>’;
echo “Commission ” . get_post_meta( $post->ID, ‘wpam_woo_product_specific_commission’, true ) . ” $ “;
echo ‘</span>’;
}
}
—–
To display the commission in the product page you need to add this code to the end of the price.php file in the woocommerce templates folder under single-product (woocommerce/templates/single-product/price.php)
—–
<?php
echo “Commission ” . get_post_meta( get_the_ID(), ‘wpam_woo_product_specific_commission’, true ) . ” $ “;
?>
—–
Finally, as you edited one of the woocommerce core files, you may need to use this tool “WordPress child plugin tool” to avoid losing the modifications you made when woocommerce update
https://github.com/ThomasDepole/wordpress-child-plugin-tool
Hope this help
Thanks