• Digital Duck

    (@digitalduckplugins)


    Hi, Hope everythings going well.

    I have two requests, and code snippets to full fill them.

    With the recent changes that check if a product is virtual or not, can we add in a check to make sure the method exists. (If a product is removed from the site, then the $product variable is empty and causes an error).

    Here’s the code snippet to fix.
    Line 460 woocommerce-partial-shipments.php

    if(is_array($wxp_shipments) && !empty($wxp_shipments) && (method_exists($product,'is_virtual') && !$product->is_virtual())){

    The second thing is while adding an order manually, the “shipment” button is displayed, which when clicked just spins. Here’s a quick video:
    https://share.thedigitalduck.co.uk/ipboJJ

    Could we add a check to see if the order being viewed is being created manually, here’s the code snippet.
    Line 220+ wxp_order_shipment_button() woocommerce-partial-shipments.php

    function wxp_order_shipment_button($order){
    		if ( !$order->is_editable() ) {
    			echo '<button type="button" data-order-id="'.$order->get_id().'" class="button wxp-order-shipment">'.__('Shipment','wxp-partial-shipment').'</button>';
    		}
    	}

    Thanks, Toby

    • This topic was modified 3 years, 7 months ago by Digital Duck.
    • This topic was modified 3 years, 7 months ago by Digital Duck.
  • The topic ‘Virtual Product, checking & hide button on create order screen’ is closed to new replies.