Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'wcfm_product_bulk_edit_start', function() {
- $product_types = apply_filters( 'wcfm_product_types', array(
- '' => __( '— No change —', 'wc-frontend-manager' ),
- 'simple' => __( 'Simple Product', 'wc-frontend-manager' ),
- 'variable' => __( 'Variable Product', 'wc-frontend-manager' ),
- 'grouped' => __( 'Grouped Product', 'wc-frontend-manager' ),
- 'external' => __( 'External/Affiliate Product', 'wc-frontend-manager' )
- ) );
- if( count( $product_types ) == 0 ) {
- $product_types = array( '' => __( '— No change —', 'wc-frontend-manager' ) );
- }
- ob_start();
- ?>
- <div class="inline-edit-group inline-edit-group-type">
- <label>
- <span class="wcfm_popup_label title"><?php _e( 'Type', 'wc-frontend-manager' ); ?></span>
- <span class="input-text-wrap">
- <select class="change_product_type wcfm_popup_input change_to" name="_product_type">
- <?php
- foreach ( $product_types as $key => $value ) {
- echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
- }
- ?>
- </select>
- </span>
- </label>
- </div>
- <?php
- echo ob_get_clean();
- } );
- add_action( 'wcfm_product_bulk_edit_save', function( $product, $wcfm_bulk_edit_form_data ) {
- if( isset( $wcfm_bulk_edit_form_data['_product_type'] ) && ! empty( $wcfm_bulk_edit_form_data['_product_type'] ) ) {
- wp_set_object_terms( $product->get_id(), $wcfm_bulk_edit_form_data['_product_type'], 'product_type', false );
- }
- }, 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement