Advertisement
nshelper

Untitled

Mar 27th, 2024 (edited)
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. add_filter( 'woogc/ps/synchronize_product/child_product', 'sync_custom_taxonomy_to_child_product', 10, 3 );
  2. function sync_custom_taxonomy_to_child_product( $child_product, $main_product_data, $origin_product_blog_ID )
  3. {
  4. $taxnomy_name = 'writer';
  5.  
  6. //switch back to the origin product shop
  7. switch_to_blog( $origin_product_blog_ID );
  8.  
  9. $main_product = new WC_Product( $main_product_data[ 'id' ] );
  10.  
  11. $main_product_terms_ids = wp_get_object_terms( $main_product->get_ID(), $taxnomy_name, array( 'fields' => 'ids' ) ) ;
  12.  
  13. restore_current_blog();
  14.  
  15. if ( count ( $main_product_terms_ids ) > 0 )
  16. {
  17. $WooGC_PS = new WooGC_PS();
  18.  
  19. var_dump( $main_product_terms_ids );
  20. var_dump( $child_product );
  21. var_dump( $origin_product_blog_ID );
  22. var_dump( $taxnomy_name );
  23.  
  24. //$WooGC_PS->synchronize_taxonomy ( $main_product_terms_ids, $child_product->get_ID(), $origin_product_blog_ID, $taxnomy_name );
  25. }
  26.  
  27. return $child_product;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement