1

In my drupal commerce I have a product type. it's name is "Cellphone"

in my product type I have a field named "color" that in field settings I have set this check box "Enable this field to function as an attribute field on Add to Cart forms." so this field is an attribute. color has two options. One is red and another is blue.

When I want to create a product display , I make two products for this product display one is blue and another is red. So in product display, visitor is able to change the product via color attribute.

Now I have made and price attribute for my products. It's name is guarantee and it includes two options. "Type A" that increases price $100 and "Type B" that increases price $200

every thing works well. in product display page and during ordering, when user set color and also set an attribute, price of product change correctly. but after click on "Add to cart" button, the new item in shopping card block doesn't have correct price (it has base price without any attribute effects) and when user press on F5 and refresh the browser page, shopping card block is corrected

do you know what is the reason and how can I solve this problem ?

  • Are you using any other modules to add to card? For example an Ajax module or some other customized add to cart Javascript? Or is this vanilla Drupal Commerce? – nvahalik Nov 9 '15 at 2:32
  • No. At first I tested these modules but they had problem too. So I disabled all of AJAX module for commerce. But it didn't work. – Mehrdad201 Nov 9 '15 at 17:10
  • What about the shopping cart block? Is that loading via Ajax? Also, how are you setting the price of the products? Is that done via rules or are you handling it with separate SKUs? – nvahalik Nov 9 '15 at 17:47
  • no. nothing is AJAX. but when I select attributes it causes change on price. then I press over add to cart button. page is refreshed. I see added product in shopping cart block. but the price is not correct. when I press F5 again and page is refreshed for the second time, shopping cart becomes true. – Mehrdad201 Nov 11 '15 at 8:27
0

Here is where I would do like the big stores, and add a separate line item (product) for the warrantee add-on where you you can have two variations of it, one for $100 add-on value, the other for $200 add-on and then in the product display page you can have a customer select which option if any to select, which will then be itemized in the cart by itself with its own description. If you want you can also have a product display page or just a page for the two to them. It would be a product type by itself, with variations as opposed to color terms describing variations of a cell phone. And it might be easier on cart space. And Warrantee variations are products that can be related by name. You end up with less sku products: The cell phone product color variations, and the Warrantee two variations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.