Woocommerce change prices for a certain country [closed]

You need to use the woocommerce_get_price filter: add_filter(‘woocommerce_get_price’, ‘return_custom_price’, $product, 2); function return_custom_price($price, $product) { global $post, $woocommerce; // Array containing country codes $county = array(‘CH’); // Amount to increase by $amount = 5; // If the custromers shipping country is in the array if ( in_array( $woocommerce->customer->get_shipping_country(), $county ) ){ // Return the price … Read more

Revoke Access to certain user roles and admin pages

You can do this several ways, it just depends on how specific you want to get. Like do you need to disable for only one user with the ID of 21 or was that just an example? And are you trying to disable several pages or just a couple? Example 1: You can do this … Read more

get_users meta_query: REGEXP not working for matching new lines

I found the problem and also fixed a bug in the regex. Final code: ‘meta_query’ => array( array( ‘key’ => ‘my_meta_field’, ‘value’ => “(^|\n|\r\n)99999($|\n|\r\n)”, ‘compare’ => ‘REGEXP’, ), ), The problem here was WordPress was adding extra backslashes on the special characters. By wrapping the expression in double quotes, this problem was solved. Also added … Read more

How to correctly add Javascript to this PHP ‘Page Not Found’ Page?

Problem The Short Version The problem isn’t how you’re using those scripts or where you’re placing them – it’s how the authors of those scripts wrote them. The Long Version Your “superfish” script which controls the functionality of your navigation menu is throwing errors because $.browser is undefined. While $.browser was deprecated more than 3 … Read more