* Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once '../vendor/autoload.php'; use Wish\WishClient; $token = 'ACCESS_TOKEN'; $client = new WishClient($token, 'sandbox'); try { //Get your product by its ID $product = $client->getProductById('535d205bb9ee84128ac15fc0'); print_r($product); //Get your product variation by its SKU $product_var = $client->getProductVariationBySKU('var 7'); print_r($product_var); //Enable or disable your product variation $client->enableProductVariation($product_var); //or $client->enableProductVariationBySKU('var 6'); $client->disableProductVariation($product_var); //or $client->disableProductVariationBySKU('var 6'); //Update your product variation and save it $product_var->inventory = 10; $client->updateProductVariation($product_var);
<?php /** * Copyright 2014 Wish.com, ContextLogic or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once '../vendor/autoload.php'; use Wish\WishClient; $token = 'ACCESS_TOKEN'; $client = new WishClient($token, 'sandbox'); //Get an array of all your products $products = $client->getAllProducts(); print count($products); //Get an array of all product variations $product_vars = $client->getAllProductVariations(); print count($product_vars);
/** * Copyright 2014 Wish.com, ContextLogic or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once '../vendor/autoload.php'; use Wish\WishClient; use Wish\Exception\ServiceResponseException; $token = 'ACCESS_TOKEN'; $client = new WishClient($token, 'sandbox'); $product = array('name' => 'Red Shoe', 'main_image' => 'https://www.google.com/images/srpr/logo11w.png', 'sku' => 'prod 7', 'parent_sku' => 'prod 7', 'shipping' => '10', 'tags' => 'red,shoe,cool', 'description' => 'a cool shoe', 'price' => '100', 'inventory' => '10', 'randomfield' => '12321'); try { $prod_res = $client->createProduct($product); print_r($prod_res); $product_var = array('parent_sku' => $product['parent_sku'], 'color' => 'red', 'sku' => 'var 7', 'inventory' => 10, 'price' => 10, 'shipping' => 10); $prod_var = $client->createProductVariation($product_var); print_r($prod_var); } catch (ServiceResponsException $e) { echo "There was an error performing an operation.\n"; }
* * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once '../vendor/autoload.php'; use Wish\WishClient; use Wish\Model\WishTracker; use Wish\Exception\OrderAlreadyFulfilledException; use Wish\Model\WishReason; $token = 'ACCESS_TOKEN'; $client = new WishClient($token, 'sandbox'); //Fulfill one order by ID //$tracker = new WishTracker('USPS','123123123','Thanks for buying!'); //$client->fulfillOrderById('537850c38b72ac0db9472cb4',$tracker); //or //$one_order = $client->getOrderById('53767deb43d2470c6d04d856'); //$client->fulfillOrder($one_order); //Get an array of all changed orders since January 20, 2010 $changed_orders = $client->getAllChangedOrdersSince(); print count($changed_orders) . " changed orders.\n"; //Get an array of all unfufilled orders since January 20, 2010 $unfulfilled_orders = $client->getAllUnfulfilledOrdersSince('2010-01-20'); print count($unfulfilled_orders) . " changed orders.\n"; //Fulfill all unfulfilled orders foreach ($unfulfilled_orders as $order) { try {
<?php /** * Copyright 2014 Wish.com, ContextLogic or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once '../vendor/autoload.php'; use Wish\WishAuth; use Wish\WishClient; $auth = new WishAuth('CLIENT_ID', 'CLIENT_SECRET', 'sandbox'); $response = $auth->getToken('ACCESS_TOKEN', 'https://website.com'); $token = $response->getData()->access_token; $client = new WishClient($token, 'sandbox'); print "RESULT: " . $client->authTest();