Remove action prices, keep variables?
-
I’m running a site that sells speakers.
I’ve added the following to custom-woocommer.php
if (is_user_logged_in() && !current_user_can(‘subscriber’) && !current_user_can(‘customer’) || $visitorGeolocation[‘countryName’] == DENMARK) {
/* do nothing */
}
else
{
remove_action( ‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_template_loop_price’, 10 );
remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_price’, 10 );
remove_action( ‘woocommerce_variable_add_to_cart’, ‘woocommerce_variable_add_to_cart’, 30 );
remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 10 );
remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );
remove_action( ‘woocommerce_simple_add_to_cart’, ‘woocommerce_simple_add_to_cart’, 30 );
remove_action( ‘woocommerce_grouped_add_to_cart’, ‘woocommerce_grouped_add_to_cart’, 30 );
}The main idea here, is that we only sell to one country.
However, when I use theese remove actions, to remove the “add to cart” function, it also removes my variables.
The speakers have for example some finish variables such as: Black ash, high glosh black etc.I still want users from outside of Denmark to see the variables, they should just not see the price and be able too add to the cart.
How can I achive this?
The topic ‘Remove action prices, keep variables?’ is closed to new replies.