Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Wocommerce reward points on own my account tab WordPress


I am using
Wocommerce pints and rewards for woocommerce.

I want a function that will remove it from the main my-account page and place it under its own tab

i think there should be a way to unhook it from the main my-account page and add it to another

see screenshot is default of where the points and reward points goes. just need to remove it from there and add to another page

Answers (2)


Dbranes answers:

You could try to remove it with:

remove_action( 'woocommerce_before_my_account', 'woocommerce_points_rewards_my_points' );

within a suitable hook, that runs after:

add_action( 'woocommerce_before_my_account', 'woocommerce_points_rewards_my_points' );

Then use the template function <em>woocommerce_points_rewards_my_points()</em> where you need to display this info.

You could also display it through a relevant hook.

James Dean comments:

ok great thanks, so far i have removed the action with remove_action( 'woocommerce_before_my_account', 'woocommerce_points_rewards_my_points' ); which is great thanks for the woocommerce_before_my_account' good to know.

I have added my-points.php to theme/woocommerce/myaccount
and added the endpoint to the
WC_Query::init_query_vars() add to the array:
'my-points' => 'my-points',

Now i simply need to call the the template function woocommerce_points_rewards_my_points() in my-points.php

seems simple but im suck here whats the best way to call this require_once ?..


James Dean comments:

i forgot to mention i also

in WC_Shortcode_My_Account::output() added:

} elseif ( isset( $wp->query_vars['my-points'] ) ) {
wc_get_template( 'myaccount/my-points.php', array( 'user' => get_user_by( 'id', get_current_user_id() ) ) );

now i can see my page my-points.php is loading correcly and i just need to call the template function woocommerce_points_rewards_my_points() how to ?


Romel Apuya answers:

why not override the my-account page in your theme?
copy the my-account.php to your theme

add themedirectory/woocommerce/myaccount/my-account.php