/** * Update the corresponding Square Item for a WC Product. * * See: https://docs.connect.squareup.com/api/connect/v1/#put-itemid * * @param WC_Product $wc_product * @param string $square_item_id * @param bool $include_category * @param bool $include_inventory * @return object|bool Updated Square Item object on success, boolean False on failure. */ public function update_square_product($wc_product, $square_item_id, $include_category = false, $include_inventory = false) { // We can only handle simple products or ones with variations if (!in_array($wc_product->product_type, array('simple', 'variable'))) { return false; } // TODO: Consider making this method "dumber" - remove this formatting call. $product = WC_Square_Utils::format_wc_product_update_for_square_api($wc_product, $include_category); $endpoint = 'items/' . $square_item_id; return $this->_client->request('Updating a Product', $endpoint, 'PUT', $product); }