• Hi there,

    Thank you for you great work on this plugin ??
    I just have one question, is there a possibility that the amount of units that is in a package is the amount of products that is shown in the order overview?
    So for example we have a product that is being sold in a package of 8 pieces, and the customer is buying 2 packgage, we would like to see in the order overview 16 pieces instead of 2 packages.
    Do you think there is a possibility to make this a possibility?

    Best regards,
    Olga

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author arosoft

    (@arosoft)

    Hi Olga.

    Yes, it is possible. We have not implemented this in the plugin yet but for example, if you wish to add this info to the admin order page you could add this piece of code into your themes functions.php file.

    
    add_action('woocommerce_admin_order_item_headers', 'test_woocommerce_admin_order_item_headers');
     
    function test_woocommerce_admin_order_item_headers() {
    
        $column_name = esc_textarea('Pieces');
    
    	echo '<th>' . $column_name . '</th>';
    }
    
    add_action('woocommerce_admin_order_item_values', 'test_woocommerce_admin_order_item_values', 10, 3);
    
    function test_woocommerce_admin_order_item_values($_product, $item, $item_id = null) {
    	$batch_name = get_option('otfw_batch_attribute_to_use');
    	if(!is_null($_product)){
    		$batch =  get_the_terms( $_product->get_id(), $batch_name);
    		$batch_qty = isset($batch[0]->name) ? (int) $batch[0]->name : '';
    		$total_quantity = is_numeric($batch_qty) ?  $batch_qty * $item->get_quantity() : 0;
    		if(is_numeric($total_quantity) && $total_quantity != 0){
    			echo '<td>' . $total_quantity  . ' ' .esc_textarea('pieces').'</td>';
    		}else{
    		 echo '<td></td>';
    		}
    
    	}
    }
    • This reply was modified 3 years, 9 months ago by arosoft.
    Thread Starter oberning

    (@oberning)

    Hi @arosoft

    Thank you for the snippet.
    Unfortunately it’s not exactly what I meant. We need the qty of the product to be to total amount of units. Because sometimes we need to take out one piece of the package so we need to be able to make a package of 7 instead of 8 on the backend.

    So I thought there could be a way to multiply the batch number with the qty number of something like that?

    Maybe it’s not possible with this plugin, so I will continue searching.

    Thanks a lot so far, I’m sure it will help other people ??

    Best,
    Olga

    Plugin Author arosoft

    (@arosoft)

    Hi @oberning

    Just to clarify about the snippet. It does multiply the batch qty with the product qty.
    But the snippet is only for when you look at the order on the admin order page.

    $total_quantity = is_numeric($batch_qty) ? $batch_qty * $item->get_quantity() : 0;

    Thread Starter oberning

    (@oberning)

    Hi @arosoft

    If you see my screenshot, you see the column that is added is right, 16pcs, but the qty is still 2:

    https://www.fosamsterdam.nl/wp-content/uploads/Qty-batch.jpg

    Plugin Author arosoft

    (@arosoft)

    Hi,
    no that’s right, the product quantity will not change. The new column will only display the total number of pieces. In your example from the screenshot, I guess the batch size is 8 so 2×8 = 16.

    But to do it the other way, to have the product quantity as the single piece quantity is not possible in this plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘use the total units in order overview’ is closed to new replies.