/** * Create a Square Item for a WC Product. * * See: https://docs.connect.squareup.com/api/connect/v1/#post-items * * @param WC_Product $wc_product * @param bool $include_category * @param bool $include_inventory * @return object|bool Created Square Item object on success, boolean False on failure. */ public function create_square_product($wc_product, $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_create_for_square_api($wc_product, $include_category, $include_inventory); return $this->_client->request('Creating Product', 'items', 'POST', $product); }