Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #348913

    Hi – when I use my own WooCommerce “Add to Cart” buttons, the “popup message” on the cart omits the product name and just says :-

    “” was added to the cart

    The product_id and/or SKU code are set correctly in the link AND the item is correctly added to the cart – it’s just the transitory popup which is incorrect. However, on a standard WooCommerce product page, or using a link created by the WooCommerce widget, the transitory message is fine.

    I’ve checked and double-checked the <a href=… in great detail and can’t see anything wrong – please can someone have a look?

    I’ve included the link as “private content”. To reproduce the problem :-

    [1] Click on “+1 User License” for example – it works fine.
    [2] Click on one of the custom “Add to Cart” buttons, and it will say “” was added to the cart

    Please can someone let me know if this is a bug or if I’m doing something wrong?

    Kind Regards,

    Hedley

    • This topic was modified 10 years ago by hmuscroft.
    #349023

    Hey hmuscroft!

    You can find the javascript for that on lines 73 – 76 in /enfold/config-woocommerce/woocommerce-mod.js.

    var productContainer = jQuery(this).parents('.product').eq(0), product = {};
    	product.name	 = productContainer.find('.inner_product_header h3').text();
    	product.image	 = productContainer.find('.thumbnail_container img');
    	product.price	 = productContainer.find('.price .amount').last().text();
    

    You can see it’s grabbing the information based on the parent elements that are surrounding the add to cart button. You can try surrounding your button with those elements so it will pick up the title, price, etc etc. For what your trying to do it might look weird but you can hide them with CSS.

    Regards,
    Elliott

    • This reply was modified 10 years ago by Elliott.
    #349581

    Excellent – thanks for your help!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘[BUG?] "" was added to the cart’ is closed to new replies.