Hello,
I’ve created a custom element that is very similar to the woocommerce Add to cart form. I have it all working essentially. My only issue is the client wants the mini cart to refresh when the product is added from this element. The element will only be present on the home page. I’ve tried working with cart fragments but don’t seem to be having much luck.
I have enqueued the following in my child theme: wp_enqueue_script( ‘wc-cart-fragments’ );
And have the following in it as well.
I believe what I’m trying to reference in the $fragments[] is incorrect but I’m not sure. Is there something I should be referencing for it or that I’m missing. I have slight workaround by adding in a location.reload() after a successful Ajax call but it’s not ideal.
The custom element itself is mostly built through cornerstone and using the code above. The cart modal is just the default one provided through Cornerstone Pro.
If you need more info please let me know! Thank you.