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 code retrieves course data from an external API and displays it in the user's | |
* My Account area. A merchant has noticed that there's a delay when loading the page. | |
* | |
* 1) What changes would you suggest to reduce or remove that delay? | |
* 2) Is there any other code changes that you would make? | |
*/ | |
public function add_my_courses_section() { | |
// get external api user id from user's meta for current user |
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 | |
//Order Desk API: Insert New Shipments | |
//To get your Store ID and API Key, go to Order Desk > Settings > Advanced | |
//Setup | |
$store_id = 0; | |
$api_key = ""; | |
//Build Shipment Here | |
$new_shipments = array( |
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 | |
//Order Desk API: Get Inventory Items | |
//To get your Store ID and API Key, go to Order Desk > Settings > Advanced | |
//Setup | |
$store_id = 0; | |
$api_key = ""; | |
//Setup cURL Variables | |
$url = "https://app.orderdesk.me/api/inventory_items"; |
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 | |
//Check For Order | |
if (!isset($_POST['order'])) { | |
header(':', true, 400); | |
die('No Data Found'); | |
} | |
//Cbeck Store ID | |
//Be sure to set your store ID. Ask Order Desk support if you aren't sure what it is. | |
if (!isset($_SERVER['HTTP_X_ORDER_DESK_STORE_ID']) || $_SERVER['HTTP_X_ORDER_DESK_STORE_ID'] != "YOUR-STORE-ID") { |
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 | |
//Order Desk API: Delete Shipments | |
//To get your Store ID and API Key, go to Order Desk > Settings > Advanced | |
//Setup | |
$store_id = 0; | |
$api_key = ""; | |
//Required: source_id or order_id | |
//Required: tracking_number or shipment_id |
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 | |
class OrderDeskApiClient | |
{ | |
private $store_id; | |
private $api_key; | |
private $base_url = "https://app.orderdesk.me/api/v2"; | |
public $last_status_code = ""; | |
public function __construct($store_id, $api_key) { |
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 | |
//Order Desk API: Get Order List | |
//To get your Store ID and API Key, go to Order Desk > Settings > Advanced | |
//Setup | |
$store_id = 0; | |
$api_key = ""; | |
//Setup Query | |
$args = array( |
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
/** | |
* Register a shipping method. | |
* | |
* Registers a shipping method ready to be loaded. Accepts a class name (string) or a class object. | |
* | |
* @package WooCommerce/Classes/Shipping | |
* @since 1.5.7 | |
*/ | |
function woocommerce_register_shipping_method( $shipping_method ) { | |
WC()->shipping->register_shipping_method( $shipping_method ); |
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
#!/bin/sh | |
for dir in /DIRECTORY_PATH/*/ | |
do | |
dir=${dir%*/} | |
echo ${dir##*/} | |
cd "$dir" | |
phpcs --standard=PHPCompatibility --runtime-set testVersion 5.6 $(find . -name '*.php') >> /DIRECTORY_PATH/${dir##*/}.log | |
done |