Show special field when correct shipping is chosen

You need to setup the change event on the field: $(‘select.shipping-field’).on(‘change’, function()) { $.post( ajaxurl, { action: ‘shipping_special’, data: ‘your data here..’ }, function(response){ // The response should contain your special field HTML } ); }); You can pass the current shipping select option Then your theme’s functions.php file needs to have the action to … Read more

Problem with parameters in url and pagination

Use remove_query_arg() function. DOCUMENTATION and EXAMPLES remove_query_arg( ‘message’ ) ; in pagination code like this. $current_page = max(1, get_query_var(‘paged’)); echo paginate_links(array( ‘base’ => remove_query_arg( ‘message’,get_pagenum_link(1) ) . ‘%_%’, ‘format’ => ‘page/%#%/’, ‘current’ => $current_page, ‘total’ => intval($total_patients / 10) + 1, ‘prev_next’ => true, ‘type’ => ‘list’, ));

WooCommerce registration password field not displaying

To enable default Password field I just had to check checkbox (When creating an account, automatically generate an account password) under WooComemrce > Settings > Accounts and Privacy. After this default password field started to display on registration page. To add repeat password field I used this hook add_action( ‘woocommerce_register_form’, ‘wc_register_form_password_repeat’ ); function wc_register_form_password_repeat() { … Read more

Append country to ‘pretty’ url but serve same page

If you are needing one rewrite rule for that single page, this snippet should get you there. You’ll need to replace the XXXX in that snippet to be your post ID of your signup page. function signup_pg_rewrite_rule() { add_rewrite_rule(‘^signup/([^/]*)/?’,’index.php?page_id=XXXX&country_code=$matches[1]’,’top’); } add_action(‘init’, ‘signup_pg_rewrite_rule’, 10, 0); After you drop this in, you’ll need to flush that rewrite … Read more

Custom attribute type not displaying terms in edit product – WooCommerce

I just had that problem and resolved it alone since i could not find the answer online. You just need to put that code inside an if. Only to run that code on attribute page. if ($_GET[‘page’]==’product_attributes’) { add_filter( ‘product_attributes_type_selector’, function($array){ $array[‘test’] = __( ‘Test’, ‘awcs’ ); } ); }