Home › Forums › WoodMart support forum › ADD CUSTOM CONTENT TO MINI CART
ADD CUSTOM CONTENT TO MINI CART
- This topic has 9 replies, 2 voices, and was last updated 1 year, 7 months ago by Artem Temos.
-
AuthorPosts
-
April 20, 2023 at 2:20 pm #460978
Cioppi88ParticipantHi guys,
I follow this guide that you share here: https://xtemos.com/forums/topic/related-products-popup/#post-359717Follow this guide I implement my custom function with conditional logic (Cart contain only 1 product). The codie is this one:
add_action( 'woocommerce_widget_shopping_cart_total', function(){ if ( WC()->cart->get_cart_contents_count() === 1 ) { echo do_shortcode( '[html_block id="134994"]' ); } }, 5 );
It works perfectly if I use add-to-cart icon on product hover, but if I try to add to cart a prodcut from product details I need to refresh the page in order to see the content. The shortcode contains Woodmart Product Grid Widget with Cross Sell Query.
Here a video explain: https://www.berrycast.com/conversations/61a4654f-62d8-5e3b-b55b-c91df0ccc71e
April 20, 2023 at 5:06 pm #461037
Artem TemosKeymasterHello,
We tested this code and see that it doesn’t work as you expected. Our element that displays products is not intended to be used this way in the shopping cart and that is why it works unstable there. Unfortunately, we can’t give you a fix for this problem.
Kind Regards
April 20, 2023 at 5:58 pm #461051
Cioppi88ParticipantDo you have a solution in order to display upsell product on shopping widget cart?
April 20, 2023 at 6:07 pm #461052
Cioppi88ParticipantMoreover this doesn’t explain why if I click add to cart on hover to product grid it works and if I click from product page not.
It’s not a problem of the widget I think.
April 20, 2023 at 7:21 pm #461062
Cioppi88ParticipantI don’t want to fix widget behaviour, it works well, I’d like to know if exist a method to refresh fragments on product page in order to works with my custom code, maybe it’s a problem of priority in the snippets I added. I don’t know, I’m not very expert.
April 20, 2023 at 7:30 pm #461064
Cioppi88ParticipantThe problem is related to Ajax, if I disable it it works perfectly. Does exist a method to fix my code in order to works after ajax update?
April 20, 2023 at 7:41 pm #461065
Cioppi88ParticipantI try this in order to execute the code after cart fragment update but it doesn’t works:
add_action( 'wc_fragments_refreshed', function(){ add_action( 'woocommerce_widget_shopping_cart_total', function(){ if ( WC()->cart->get_cart_contents_count() === 1 ) { echo do_shortcode( '[html_block id="134994"]' ); } }, 5 ); });
I thik that I need to execute after woodmart function but I don’t know which one I’ll need to call
April 21, 2023 at 9:17 am #461155
Artem TemosKeymasterHello,
Yes, this widget doesn’t work properly and is not as you expected. As we mentioned, we don’t have a fix for this and it is beyond our support scope since it is related to additional code customization.
Kind Regards
April 21, 2023 at 9:36 am #461164
Cioppi88ParticipantSorry but can you please make more time in order to find a solution that can works instead of a “non support scope” response. I know is not related but maybe you can help me to find the better way how I can implement this solution. If I override the mini cart template of the theme in my child theme? Or maybe use this code differently. An in-depth help is appreciated expecially from who acquired different licence as me! Thanks
April 24, 2023 at 9:15 am #461609
Artem TemosKeymasterHello,
We already tried to fix this but it seems it is not as simple as we thought. That is why, we can’t fix the problem with this specific code.
Kind Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register