# MD for: https://www.mercadopago.com.br/developers/es/docs/checkout-pro/additional-settings/preference-multiple-items.md \# Create preference for multiple items To create a preference with more than one item, you need to add these items to a list and provide the required attributes for each of them. > NOTE > > In addition to the SDKs, it is also possible to create a preference for multiple items directly through the Preferences API. To do this, send a POST request to the endpoint :TagComponent{tag="API" text="/checkout/preferences" href="/developers/en/reference/online-payments/checkout-pro/preferences/create-preference/post"}, including all desired items in the \`items\` array. Use one of the available SDKs to perform this operation: * [csharp ](#editor%5F6) * [java ](#editor%5F3) * [node ](#editor%5F2) * [php ](#editor%5F1) * [python ](#editor%5F5) * [ruby ](#editor%5F4) php node java ruby python csharp ``` title = "Test Item 1"; $item1->quantity = 2; $item1->unit_price = 11.96; $item2= new MercadoPago\Item $item2->title = "Test Item 2"; $item2->quantity = 1; $item2->unit_price = 11.96; $preference->items = array($item1,$item2); # Save and post the preference $preference->save(); ?> ``` Copiar ``` const preference = new Preference(client); preference.create({ body: { // ... items: [ { title: 'My product 1', quantity: 1, unit_price: 100 }, { title: 'My product 2', quantity: 1, unit_price: 150 } ], } }) // ... ``` Copiar ``` // Create a preference object PreferenceClient client = new PreferenceClient(); // Create items in preference PreferenceClient client = new PreferenceClient(); List items = new ArrayList<>(); PreferenceItemRequest item1 = PreferenceItemRequest.builder() .id("1234") .title("Product 1") .quantity(2) .currencyId("BRL") .unitPrice(new BigDecimal("100")) .build(); PreferenceItemRequest item2 = PreferenceItemRequest.builder() .id("12") .title("Product 2") .quantity(1) .currencyId("BRL") .unitPrice(new BigDecimal("100")) .build(); items.add(item1); items.add(item2); PreferenceRequest request = PreferenceRequest.builder().items(items).build(); // Save and post the preference client.create(request); ``` Copiar ``` sdk = Mercadopago::SDK.new('ENV_ACCESS_TOKEN') # Create preference data with items preference_data = { items: [ { title: 'My product 1', quantity: 1, unit_price: 75.56 }, { title: 'My Product 2', quantity: 2, unit_price: 96.56 } ] } preference_response = sdk.preference.create(preference_data) preference = preference_response[:response] ``` Copiar ``` # Create items in preference preference_data = { "items": [ { "title": "My product", "quantity": 1, "unit_price": 75.56 }, { "title": "My product2", "quantity": 2, "unit_price": 96.56 } ] } # Create the preference preference_response = sdk.preference().create(preference_data) preference = preference_response["response"] ``` Copiar ``` // Create the request with multiple items var request = new PreferenceRequest { Items = new List { new PreferenceItemRequest { Title = "My Product 1", quantity = 1, CurrencyId = "BRL", UnitPrice = 75.56m, }, new PreferenceItemRequest { Title = "My Product 2", quantity = 2, CurrencyId = "BRL", UnitPrice = 96.56m, }, // ... }, }; // Create a client object var client = new PreferenceClient(); // Create the preference Preference preference = await client.CreateAsync(request); ``` Copiar The total value of the preference will be the sum of the price value of each item listed.