Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <?php
  2. add_filter( 'xlwcty_after_rules', 'xlwcty_filter_for_meta', 10, 3 );
  3.  
  4. function xlwcty_filter_for_meta( $bool, $page_id, $order_id ) {
  5.  
  6.  
  7. if ( false === $bool || empty( $page_id ) ) {
  8. return $bool;
  9. }
  10.  
  11. if ( 'YOUR_PAGE_ID' != $page_id ) { //REPLACE YOUR_PAGE_ID with the ID you want to navigate page to
  12. return $bool;
  13. }
  14.  
  15. $is_quote = false;
  16. $get_order = XLWCTY_Core()->data->get_order();
  17.  
  18. $items = $get_order->get_items();
  19.  
  20. foreach ( $items as $item ) {
  21.  
  22. if ( $item instanceof WC_Order_Item_Product ) {
  23. if ( 'yes' == $item->get_meta( 'request_a_quote' ) ) { // modify meta key and the value here to perform your custom key value check
  24. $is_quote = true;
  25. break;
  26. }
  27. }
  28. }
  29.  
  30. return $is_quote;
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement