Renish Khunt
Renish Khunt

Reputation: 5824

Wordpress woocommerce_get_price flter is not working?

i am used Events Plugin. the plugin link is Events Plugin Link.

This Plugin is integrated with the Woocommerce Tickets plugin.

not i want to filter price of the Tickets i used this hook for change price.

add_action('woocommerce_get_price','change_price_regular_member', 10, 2);
function change_price_regular_member($price, $product){
   return '$150';
}

This is working fine.

But this filter change value in admin side and front side.

i want to cahnge price only front side not admin side.

Thank you.

Upvotes: 0

Views: 835

Answers (2)

mindlogixtech
mindlogixtech

Reputation: 158

you can also do like this

if(!is_admin()){
   add_action('woocommerce_get_price','change_price_regular_member', 10, 2);}

Thats it. it will work.

Upvotes: 0

user2238699
user2238699

Reputation:

please return value to checking the is admin to return origin price. or front end return your price.

if ( ! is_admin() ) {
     return '$150';
} else {
     return $price;
}

i hope this is working for me.

Upvotes: 1

Related Questions