addProducts( )


Adds one or more products to the cart.

について addProducts() function returns a Promise that is resolved when the specified products are added to the cart.

を使用する。 quantity property of each AddToCartItem object that is passed to the products parameter to add one or more products to the cart at one time.

を使用する。 options property of each AddToCartItem object that is passed to the products parameter to specify the product options to choose when adding the product to the cart. For example, if a product comes in different sizes, you can specify the size that should be added to the cart. If the product you are adding to the cart has options, you must specify which options should be chosen.

You can see a product's option information in the productOptions field in the Stores/Products collection.

You can use product.getOptionsAvailability() to determine if an item with specific options is available for purchase.

注: If you use wix-stores-backend.createProduct() immediately before adding that product to the cart, we suggest setting a timeout for "1000" milliseconds (1 second) before calling cart.addProducts(). While this slows down the operation slightly, it also ensures proper retrieval of the newly created product before adding it to the cart.

メソッド宣言
コピー
メソッド・パラメータ
productsArray<AddToCartItem>Required

One or more products to be added to the cart.

リターン
Return Type:Promise<CartObj>
役に立ちましたか?
はい
いいえ