| 1 |
<?php |
| 2 |
/** |
| 3 |
* REST API WC Shipping Methods controller |
| 4 |
* |
| 5 |
* @package WCPOS\WooCommercePOS |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WCPOS\WooCommercePOS\API\V1; |
| 9 |
|
| 10 |
\defined( 'ABSPATH' ) || die; |
| 11 |
|
| 12 |
if ( ! class_exists( 'WC_REST_Shipping_Methods_Controller' ) ) { |
| 13 |
return; |
| 14 |
} |
| 15 |
|
| 16 |
use WC_REST_Shipping_Methods_Controller; |
| 17 |
|
| 18 |
/** |
| 19 |
* Shipping methods controller class. |
| 20 |
*/ |
| 21 |
class Shipping_Methods_Controller extends WC_REST_Shipping_Methods_Controller { |
| 22 |
|
| 23 |
/** |
| 24 |
* Endpoint namespace. |
| 25 |
* |
| 26 |
* @var string |
| 27 |
*/ |
| 28 |
protected $namespace = 'wcpos/v1'; |
| 29 |
|
| 30 |
/** |
| 31 |
* Check whether a given request has permission to view shipping methods. |
| 32 |
* |
| 33 |
* @param \WP_REST_Request $request Full details about the request. |
| 34 |
* @return \WP_Error|boolean |
| 35 |
*/ |
| 36 |
public function get_items_permissions_check( $request ) { |
| 37 |
if ( current_user_can( 'access_woocommerce_pos' ) ) { |
| 38 |
return true; |
| 39 |
} |
| 40 |
return parent::get_items_permissions_check( $request ); |
| 41 |
} |
| 42 |
} |
| 43 |
|