Last active
February 3, 2018 03:00
-
-
Save davidsword/941d74c586620fbff693075cb13a6b96 to your computer and use it in GitHub Desktop.
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_action('wc_square_loaded',function(){ | |
if (class_exists('Woocommerce_Square')) { | |
add_action( 'plugins_loaded', function(){ | |
// get WooCommerce_Square | |
$wcsm = Woocommerce_Square::instance(); | |
// startup, (aka `Woocommerce_Square::init()` rebuilt) | |
$wcsm->integration = new WC_Square_Integration(); | |
$wcsm_client = new WC_Square_Client(); | |
$access_token = get_option( 'woocommerce_square_merchant_access_token' ); | |
$wcsm_client->set_access_token( $access_token ); | |
$wcsm_client->set_merchant_id( $wcsm->integration->get_option( 'location' ) ); | |
$wcsm->square_client = $wcsm_client; | |
$wcsm->square_connect = new WC_Square_Connect( $wcsm_client ); | |
// basic api call | |
$response = $wcsm_client->request( 'Retrieving Products', 'modifier-lists' ); | |
// output | |
echo "<pre>".print_r($response,true)."</pre>"; | |
die; | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment