Score:0

Commerce 2 - switch variation ajax error

ng flag

I'm building a commerce site, one problem that I have is that the variation switch that works with ajax is having problems on the production server.

I have analyzed the network tab of DevTools, the situation is the following:

  • I go to a product and can switch between its variations.
  • If I add a product to the cart, then I cannot switch to another variation, the ajax request is made but instead of returning a JSON the response is a html with the whole page which results in the error.

The Ajax request url is something like:

/product/54?v=3037&ajax_form=1&_wrapper_format=drupal_ajax

If I disable the cache for dynamic content in settings.php

$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

Then everything works without any problems, is there a better solution for that?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.