Hide ‘add to cart’ when certain value in dropdown is selected

Need help here please. I am trying to hide the ‘add to cart’ woocommerce button when a user selects a specific item in a dropdown list. I have tried multiple JQuery snippets in both functions.php and through 3rd party plugins but am still struggling to get it to work.

In Functions.php theme file

function load_scripts() { ?>     <script type="text/javascript">     $  (document).ready(function(){         $  (document.getElementsByName("select-1574795073993")).change(function(){             $  ( "select option:selected").each(function(){                 if($  (this).attr("value")=="International"){                     $  (".single_add_to_cart_button").hide();                 }             });         }).change();     });     </script> <?php } add_action('wp_enqueue_scripts', 'load_scripts'); 

Please can someone assist with simple steps to 1) provide correct code, and 2) insert in the woocommerce.com hosted plarform.

Much appreciated!

how to allow user select shipping location(a custom locations dropdown) in checkout and recalculate values woocommerce

i need to know 2 things

  1. how do i add custom shipping zones to a determinate contry (I need to add some neightbours of a main city)
  2. How do i allow users to select the shipping zone when chekout or in the cart, and recalculate the total

Create languages dropdown on registration form

My site is both English and Latvian. How to add frontend dropdown on registration form where users can choose their preferred language (the language they receive WP emails, etc.)?

add_filter( 'locale', 'set_my_locale' ); function set_my_locale( $  lang ) {   if ( 'gl' == $  _GET['latvian'] ) {     // set to Latvian     return 'ka_LV';   } else {     // return original language     return $  lang;   } } 

Can someone point out how to adjust this code, so there is a dropdown on frontend registration?

How to make “formats” dropdown apply to only the selected text?

How can I make the format styles dropdown in the classic editor apply to ONLY the selected text? Right now it is applying to the nearest line break from the selected text, I don’t like that.

Here is the code in my functions.php file:

function add_style_select_buttons( $  buttons ) {     array_unshift( $  buttons, 'styleselect' );     return $  buttons; } // Register our callback to the appropriate filter add_filter( 'mce_buttons_2', 'add_style_select_buttons' ); //add custom styles to the WordPress editor function my_custom_styles( $  init_array ) {        $  style_formats = array(           // These are the custom styles         array(               'title' => 'Fancy Words',               'block' => 'div',               'classes' => 'fancywords',             'wrapper' => true,         )     );       // Insert the array, JSON ENCODED, into 'style_formats'     $  init_array['style_formats'] = json_encode( $  style_formats );        return $  init_array;    }  // Attach callback to 'tiny_mce_before_init'  add_filter( 'tiny_mce_before_init', 'my_custom_styles' ); 

Using custom post type to feed a dropdown (Woo order-id into wpforms)

Using the plugin wpForms, I can auto-populate a dropdown with Custom Post Types (they call it “Dynamic Post Type Source”). Say I wanted to use this functionality to auto-populate a dropdown with order-ids from WooCommerce, so a logged-in-user can choose between the users orders.

I’ve written the code for getting a logged-in-user order-id’s, so how would I make a CPT that would not really create new posts, but instead be populated with a logged-in-users order-ids at run time (while the user is at a page with the form dropdown on it)?

Already asked wpForms for support, they did not want to help.

Code for getting the User Order-ids:

function woo_get_orderids_per_user( $  content) {  $  userID = get_current_user_id();  if( $  userID > 0 ) {          $  orders= wc_get_orders(array(             'customer_id' => $  userID,             'return' => 'ids',         ));           foreach ($  orders as $  oids) {              $  order = wc_get_order( $  oids );             $  items = $  order->get_items();              foreach ( $  items as $  item ) {                 $  product = wc_get_product( $  item['product_id'] );                 $  productname = $  product->get_name();                 echo('<br> Product name: ');                 print_r($  productname . ' (ordrenummer: ' . $  oids . ')');             }         }  $  content = str_replace( '{woo_orderid}', $  productname . ' (Ordre ID: ' . $  oids . ')', $  content );  return $  content; }  else {     return; } 

}

change the dropdown content of author post meta in edit post – admin

I am trying to customize the author meta box in the post edit page, as you all know this dropdown is using to assign a post to a corresponding author.

I would like to change the dropdown content. Like currently, its showing display name(username). But i would like to show a user meta field rather than username. Is it possible?

So in the dropdown it will be like Display name(custom user meta field).

I have seen wp_dropdown_users, but no idea how to use it so that i can achieve.

Unity Dropdown Stays Stuck Open

As can be seen in the following video:

The dropdown stays stuck open when Unity launches the game. This happens even with a non-modified dropdown that is plopped as a new UI object inside the canvas.

I tried a blank project, and the issue does not reproduce. I tried in a blank project, and the dropdown works. I tried researching a solution, but not too sure how to find one with this problem. Maybe someone here will have an idea or two.

The repo can be downloaded at https://github.com/DenisLabrecque/Warglobe if desired.

Dropdown with two columns

I currently have a dropdown with two categories that I currently show like this: enter image description here

My issue is that I have quite a lot of Cars and Motorcycle and I`m thinking that using the version below would benefit the user. But I am not sure if it is viable from a UX point of view.

But I am curios if this version would work. Basically the dropdown having two columns that are scrollable. enter image description here

Browsers ruin password UX with dropdown menus. How can I fix it?

autofill dropdown ruining UX

FYI the image above was taken with autocomplete="new-password"

As you can see, the dropdown is covering the error message (which ends in “letters and numbers” (plus a few other error messages).

This error message is IMPORTANT, and the user MUST see it, so how do I hide the dropdown? The dropdown is preventing the user from seeing the message. You could say that “The dropdown is bad UX” in this particular circumstance

You could say to move the message below the field, but then we have the exact same problem, just from the other direction.

As far as I can tell, our solutions are:

  1. disable dropdown
  2. move message to a place where the dropdown won’t cover it (like a popup or to the side)
  3. Move the message so it is always displayed on the opposite side to the dropdown

Option 1 doesn’t work because we used to be able to disable the dropdown by setting autocomplete to "new-password" or "off" or "false" or whatever, but none of these things seem to disable the dropdown anymore.

Option 2 doesn’t really work because I want the message to be near the field to give the error message some context. I don’t really want a popup with the error message “You password is too short” because that seems like bad UX also. I guess I could move the error messages to the side of the password input, but that wouldn’t work on small devices that don’t have the screen width.

Option 3 also doesn’t seem very good because the error message is moving around based on the scroll position of the window, and moving text based on some arbitrary scroll line also seems like bad UX.

So yeah, I’m out of options, unless anybody can think of any?

Is this a browser problem? Or is there one simple trick I can use to get the good UX I desire?

Is opening a dropdown after clearing it a good practice?

Currently in our application we have a dropdown that opens again directly after getting cleared. I imagine this can be handy for some users, but annoying for others. Is this a good practice to follow?

enter image description here

Context: This is being used in combination with other dropdowns that all act as filters. A list will get limited or extended based on the values (or when they’re empty) in those dropdowns.