Skip to content
Snippets Groups Projects
Select Git revision
  • 47c8e032d55db9d809f247c6bd220213a14811a9
  • master default protected
  • devel
  • feature/add-escaping-to-templates
  • feature/add-priority-sorting
  • 3.3.3
  • 3.3.2
  • 3.3.1
  • 3.3.0
  • 3.2.1
  • 3.2.0
  • 3.1.0
  • 3.0.0
  • 2.4.12
  • 2.4.11
  • 2.4.10
  • 2.4.9
  • 2.4.8
  • 2.4.7
  • 2.4.6
  • 2.4.5
  • 2.4.4
  • 2.4.2
  • 2.4.1
  • 2.4.0
25 results

product-select.php

Blame
  • product-select.php 914 B
    <?php
    /**
     * @var \WPDesk\Forms\Field $field
     * @var string $name_prefix
     * @var string[] $value
     */
    
    ?>
    
    <select class="wc-product-search" multiple="multiple" style="width: 50%;"
    		id="<?php echo \esc_attr( $field->get_id() ); ?>"
    		name="<?php echo \esc_attr( $name_prefix ); ?>[<?php echo \esc_attr( $field->get_name() ); ?>][]"
    		data-placeholder="<?php \esc_attr_e( 'Search for a product&hellip;', 'wp-forms' ); ?>"
    		data-action="woocommerce_json_search_products_and_variations">
    	<?php
    	foreach ( (array) $value as $product_id ) {
    		$product = wc_get_product( $product_id );
    		if ( is_object( $product ) ) {
    			echo '<option value="' . \esc_attr( $product_id ) . '"' . selected(
    				true,
    				true,
    				false
    			) . '>' . wp_kses_post( $product->get_formatted_name() ) . '</option>';
    		}
    	}
    	?>
    </select>
    
    <script type="text/javascript">
    	jQuery(document.body).trigger('wc-enhanced-select-init');
    </script>