関数
Cart::batchDelete( array $args, array $payload )
カートからアイテムを一括で削除する
パラメータ パラメータ
- $args
(配列) (必須) URIパラメーター。使用しておりません
- $payload
(配列) (必須)
$_POST['payload']
に格納されたjson_encoded
データから抽出された配列- 'serials'
(配列)一つもしくはそれ以上のシリアル化されたWelcart商品の配列
- 'serials'
success
が返されるファイル: src/API/Cart.php
public function batchDelete(array $args, array $payload) { if (empty($payload['serials'])) { $emessage = $this->master->estore->getErrorCodeMap()[Store::UNKNOWN_ERROR]->message; return $this->master->estore->getErrorResponse(Store::REQUIRED_FIELDS_MISSING, ['serials'], [$emessage]); } $serials = $payload['serials']; foreach ($serials as $serial) { $serial = urldecode($serial); unset($_SESSION['usces_cart'][$serial]); /** * Fires after **one** serialized item is deleted from the cart. * * @important * @param \Aivec\Welcart\Extensions\Wishlist\API\Cart $this Instance of the `Wishlist` API class * @param string $serial The serialized Welcart item * @param array $payload See \Aivec\Welcart\Extensions\Wishlist\API\Cart::batchDelete() * for details */ do_action('wcexwl_cart_api_delete_on_complete', $this, $serial, $payload); } /** * Fires after **one or more** serialized items have been deleted from the cart. * * @important * @param \Aivec\Welcart\Extensions\Wishlist\API\Cart $this Instance of the `Wishlist` API class * @param array $serials Array of one or more serialized Welcart items * @param array $payload See \Aivec\Welcart\Extensions\Wishlist\API\Cart::postToWishlistBySerial() * for details */ do_action('wcexwl_cart_api_batch_delete_on_complete', $this, $serials, $payload); return 'success'; }