関数
Item::postToWishlist()
$_POST
の値とともにお気に入りリストに商品を追加する
戻り値 戻り値
ファイル: src/API/Item.php
public function postToWishlist() { $requiredFields = ['postId', 'sku']; foreach ($requiredFields as $field) { if (empty($_POST[$field])) { $emessage = $this->master->estore->getErrorCodeMap()[Store::UNKNOWN_ERROR]->message; return $this->master->estore->getErrorResponse(Store::REQUIRED_FIELDS_MISSING, [$field], [$emessage]); } } $post_id = (int)$_POST['postId']; $sku = (string)$_POST['sku']; $item_option = isset($_POST['itemOption']) ? $_POST['itemOption'] : []; $advance = isset($_POST['advance']) ? $_POST['advance'] : ''; $added = $this->addToWishlist($post_id, $sku, $item_option, $advance); if ($added !== true) { return $added; } if ($_SERVER['HTTP_REFERER']) { $_SESSION['usces_previous_url'] = esc_url($_SERVER['HTTP_REFERER']); } else { $_SESSION['usces_previous_url'] = str_replace('https://', 'http://', get_home_url()) . '/'; } return 'success'; }