Home Forums WoodMart support forum ADD CUSTOM CONTENT TO MINI CART

ADD CUSTOM CONTENT TO MINI CART

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #460978

    Cioppi88
    Participant

    Hi guys,
    I follow this guide that you share here: https://xtemos.com/forums/topic/related-products-popup/#post-359717

    Follow 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

    #461037

    Artem Temos
    Keymaster

    Hello,

    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

    #461051

    Cioppi88
    Participant

    Do you have a solution in order to display upsell product on shopping widget cart?

    #461052

    Cioppi88
    Participant

    Moreover 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.

    #461062

    Cioppi88
    Participant

    I 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.

    #461064

    Cioppi88
    Participant

    The 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?

    #461065

    Cioppi88
    Participant

    I 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

    #461155

    Artem Temos
    Keymaster

    Hello,

    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

    #461164

    Cioppi88
    Participant

    Sorry 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

    #461609

    Artem Temos
    Keymaster

    Hello,

    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

Viewing 10 posts - 1 through 10 (of 10 total)