-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
110 additions
and
14 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* WooCommerce POS Store Functions | ||
* | ||
* Functions for store specific things. | ||
*/ | ||
|
||
defined( 'ABSPATH' ) || exit; | ||
|
||
use WCPOS\WooCommercePOS\Services\Store; | ||
|
||
/** | ||
* Standard way of retrieving stores based on certain parameters. | ||
* | ||
* This function should be used for store retrieval so that we have a data agnostic | ||
* way to get a list of stores. | ||
* | ||
* @since 1.4.0 | ||
* | ||
* @param array $args Array of args. | ||
* @return array|stdClass Number of pages and an array of product objects if | ||
* paginate is true, or just an array of values. | ||
*/ | ||
if ( ! \function_exists( 'wcpos_get_stores' ) ) { | ||
function wcpos_get_stores( $args = array() ) { | ||
$store = new Store(); | ||
return apply_filters( 'woocommerce_pos_get_stores', array( $store ), $args ); | ||
} | ||
} | ||
|
||
/** | ||
* Main function for returning store. | ||
* | ||
* This function should only be called after 'init' action is finished, as there might be taxonomies that are getting | ||
* registered during the init action. | ||
* | ||
* @since 1.4.0 | ||
* | ||
* @param mixed $the_store Post object or post ID of the product. | ||
* @return Store|null|false | ||
*/ | ||
if ( ! \function_exists( 'wcpos_get_store' ) ) { | ||
function wcpos_get_store( $the_store = false ) { | ||
$store = new Store(); | ||
return apply_filters( 'woocommerce_pos_get_store', $store, $the_store ); | ||
} | ||
} |