-
AuthorPosts
-
September 10, 2019 at 2:46 am #1136310
Hi,
I’m looking to disable the dropdown menu of cart items that displays when Header Shopping Cart Icon is moused over and contents are in the cart. What function would achieve this?
September 10, 2019 at 6:59 pm #1136702Hey GCSkye,
Could you please attach a mockup of what you’re trying to achieve?
Could you please give us a link to your website, we need more context to be able to help you.
Best regards,
VictoriaSeptember 10, 2019 at 7:04 pm #1136709This image is what the cart item looks like when you don’t mouse over it
This is also what it should look like when it’s mouses over. No drop down…
September 11, 2019 at 6:37 pm #1137172Hi GCSkye,
Could you please give us a link to your website, we need more context to be able to help you.
Best regards,
VictoriaSeptember 11, 2019 at 6:48 pm #1137179There’s a link…
Add that item to your cart
On the top right is a shopping cart icon that will have the number 1 next to it.
hover over it…
You’ll see a drop down showing the item in your cart…I do not want that drop down to appear and I do not want a css hack. Currently running the latest version of enfold.
The above guide is how to do it on the WordPress default theme… This should paint vivid picture for you. I’m looking for the exact same solution on enfold.
I can’t paint a more vivid picture of how the enfold shopping cart system works or what I’m after. Please ask another agent for help if you’re confused.
Thank you for your time!
September 13, 2019 at 9:34 am #1137852Hi GCSkye,
The css hack that you don’t want:
.dropdown_widget.dropdown_widget_cart { display: none !important; }
You can modify this function here
in this file /enfold/config-woocommerce/config.php
to not include the html for the dropdown widget.If you need further assistance please let us know.
Best regards,
VictoriaSeptember 13, 2019 at 7:07 pm #1138142I had found the function you posted, editing it will not fully solve my problem.
This line drops the menu down but removing it also removes the numbers of items in the cart display:
'<div class="widget_shopping_cart_content"></div>';
What function is actually triggering the drop down? The one posted only creates the HTML structure for it.
September 17, 2019 at 9:56 am #1139033Hi,
Thank you for the update.
You can use the following snippet to remove the cart dropdown or to prevent it from rendering.
add_action('after_setup_theme', function() { remove_action( 'ava_before_bottom_main_menu', 'avia_woocommerce_cart_dropdown', 10); remove_action( 'ava_inside_main_menu', 'avia_woocommerce_cart_dropdown', 10); });
Add it in the functions.php file.
Best regards,
IsmaelSeptember 17, 2019 at 7:39 pm #1139227Hi Imael,
It’s great to see you in the thread! Any issue I search, always has you resolving it very expertly.
Please excuse my lack of clarification in this thread, I assumed I just wasn’t looking through the code properly. It was my expectation that removing something like a dropdown trigger would be simple. To avoid access code, I prefer not to use display:none.
I greatly appreciate you providing this code. Regretfully, it has no effect on the site. I’ve tried it myself originally, also using ‘init’.
If we did get it to work, I feel avia_woocommerce_cart_dropdown wouldn’t be the correct function to disable since I want the number of items in the cart to remain.
I’ve continued looking but still have not had any luck – a lot of content is added inside:
<div class=”widget_shopping_cart_content”></div>
The function posted by Victoria is only the root of what we’re looking for. I checked the JS files and found nothing. What is filling <div class=”widget_shopping_cart_content”></div> with content? With this information, I can resolve the issue.
September 19, 2019 at 9:24 am #1139813Hi,
Thank you for the update.
This script should remove the drop down containers, but it would be much more simple if you use the css code @Victoria suggested above.
function ava_remove_cart_widget(){ ?> <script> (function($){ $(document).ready(function(){ $('.dropdown_widget_cart, .widget_shopping_cart_content').remove(); })(jQuery); </script> <?php } add_action('wp_footer', 'ava_remove_cart_widget');
If you decided to remove the counter as well, try this one.
add_action('after_setup_theme', function() { remove_action( 'ava_main_header', 'avia_woocommerce_cart_dropdown', 10); remove_action( 'ava_before_bottom_main_menu', 'avia_woocommerce_cart_dropdown', 10); remove_action( 'ava_inside_main_menu', 'avia_woocommerce_cart_dropdown', 10); });
Best regards,
IsmaelSeptember 19, 2019 at 2:11 pm #1139925Thank you for those functions. I don’t want you guys to feel the need to keep re-coding the same answer and it not be the solution. Does anyone know what is populating the html code:
‘<div class=”widget_shopping_cart_content”></div>’;
Inside of the function avia_woocommerce_cart_dropdown? I won’t need any code solutions if you can just point me in the direction of that. I’ll take care of the rest.
September 20, 2019 at 4:37 am #1140095Hey!
That container is automatically populated by the woocommerce_mini_cart function or the ‘cart/mini-cart.php’ template.
/** * Output the Mini-cart - used by cart widget. * * @param array $args Arguments. */ function woocommerce_mini_cart( $args = array() ) { $defaults = array( 'list_class' => '', ); $args = wp_parse_args( $args, $defaults ); wc_get_template( 'cart/mini-cart.php', $args ); }
You can override that by defining the same function and return null.
function woocommerce_mini_cart() { return null; }
Cheers!
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.