-
-
Save searchwpgists/acd5568e579e695032656140900e2075 to your computer and use it in GitHub Desktop.
Add WooCommerce Orders as a SearchWP Source.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add WooCommerce Orders as a SearchWP Source. | |
// @link https://searchwp.com/documentation/knowledge-base/search-woocommerce-orders/ | |
add_action( 'plugins_loaded', function() { | |
if ( class_exists( 'WooCommerce' ) ) { | |
add_filter( 'searchwp\sources', function( $sources ) { | |
$sources[] = new \SearchWP\Sources\Post( 'shop_order' ); | |
return $sources; | |
} ); | |
add_filter( 'searchwp\post_stati\shop_order', function( $post_stati ) { | |
return array_merge( $post_stati, [ | |
'wc-pending', | |
'wc-processing', | |
'wc-on-hold', | |
'wc-completed', | |
'wc-cancelled', | |
'wc-refunded', | |
'wc-failed', | |
] ); | |
} ); | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment