Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. <?php // do not copy this line
  2.  
  3. /**
  4. * Set orders in Product Vendors to unfulfilled if the item is Virtual.
  5. */
  6. add_filter( 'wcpv_processing_init_fulfillment_status', 'set_virtual_product_unfulfilled_pv', 10, 4 );
  7. function set_virtual_product_unfulfilled_pv( $fulfillment_status, $order_item_id, $item, $order ){
  8.  
  9. // Get the product object.
  10. if ( ! empty( $item['variation_id'] ) ) {
  11. $_product = wc_get_product( $item['variation_id'] );
  12. } else {
  13. $_product = wc_get_product( $item['product_id'] );
  14. }
  15.  
  16. // Check to see if it is virtual.
  17. if ( $_product->is_virtual() ) {
  18. $fulfillment_status = 'unfulfilled';
  19. }
  20.  
  21. return $fulfillment_status;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement