Support » Plugin: WooCommerce » Using cart widget 2 times

  • Hello,

    I´m using a theme that use Widget Cart in the Header.

    I,ve added the widget also in the sidebar but sidebar widget didn’t updated after adding product in cart.

    Actually product will be added to cart but sidebar widget won’t be updated. For that user must refresh page. (Check http://farmafuen.es.82-194-77-85.linux2.blackslot.com/ and press “Añadir al Carrito” button. )

    The theme´s developer says that this occurs because the widget javascript (from woocommerce in wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.js on line 58) it handle one widget per page.

    How could I make that both widgets works?

    Regards

    http://wordpress.org/extend/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • line 58 of add-to-cart.js just checks to see if a cart widget exists.
    line 59, on the other hand – where the data is loaded uses the :eq(0) to ensure only the first instance gets updated.

    I suppose if you dequeued that add-to-cart.min.js script and enqueued a replacement that didn’t use that psuedo-element selector, it would update both.

    you need to remove the second instance of :eq(0) only (there are 4 in the whole file).

    if you remove others, you’ll get very strange behavior

    you could just modify the file directly, but then you’d lose your fix on the next update (and you’d want to check if any updates got applied to the add-to-cart script upon each update anyway)

Viewing 1 replies (of 1 total)
  • The topic ‘Using cart widget 2 times’ is closed to new replies.