- This topic has 32 replies, 3 voices, and was last updated 4 years, 1 month ago by
David.
-
AuthorPosts
-
April 18, 2022 at 8:09 am #2192487
Deyson
Hello and good day.
I sell digital downloads as well as yearly subscriptions.
When an active member is logged in they have the user role “Active Subscriber” and they have instant access to all the digital downloads.Is there a way to hide the small cart icon in the Niche top main menu as they do not need to go through checkout?
Please let me know what you think. ๐ค
Thank you and have an amazing day! ๐April 18, 2022 at 8:33 am #2192509David
StaffCustomer SupportHi there,
according to the Woo filter reference theres a
wcs_user_has_subscriptionfilter for setting subscription status which having a nose around led me to this method to check if a user has an active sub:$has_sub = wcs_user_has_subscription( '', '', 'active' );Which we can use ina GPP
option_generate_woocommerce_settingsfilter to set some parameters using this snippet:add_filter( 'option_generate_woocommerce_settings','hide_menu_cart_if_active_sub' ); function hide_menu_cart_if_active_sub( $options ) { $has_sub = wcs_user_has_subscription( '', '', 'active' ); if ( $has_sub ) { $options[โcart_menu_itemโ] = false; } return $options; }April 19, 2022 at 7:55 am #2193694Deyson
Thank you, very much! ๐
Do you happen to know how to redirect the Minu Cart to the Checkout and not the cart page?
Thank you and have an amazing day! ๐
April 19, 2022 at 8:07 am #2193709David
StaffCustomer SupportHmmm…. to change the cart link would mean replacing the entire function. Are you not using the Cart Sub Menu ? As that has a link to the Checkout
April 19, 2022 at 8:23 am #2193725Deyson
The cart submenu stopped working and I could not figure out why. ๐
April 19, 2022 at 9:28 am #2193763Ying
StaffCustomer SupportHi Deyson,
Can you check customizer > layout > woocommerce > general, if the
Display mini cart sub-menuis ticked?Let me know!
April 19, 2022 at 9:48 am #2193786Deyson
It is checked. ๐
Thank you and have an amazing day! ๐
April 19, 2022 at 2:44 pm #2194024Deyson
I am sorry, I had meant it is Ticked. ๐
April 19, 2022 at 9:10 pm #2194225Ying
StaffCustomer SupportIt looks like the cart function has some issue, the sub menu doesn’t load.
Are you using any custom functions related to the cart?
Let me know!
April 20, 2022 at 4:33 am #2194596Deyson
Hello,
I added disabled cart fragments, which may be the cause.
From what I understand this helps lower load time on my website.add_action( 'wp_print_scripts', 'de_script', 100 ); function de_script() { wp_dequeue_script( 'wc-cart-fragments' ); return true; }Please let me know what you think. ๐ค
April 20, 2022 at 4:48 am #2194604David
StaffCustomer SupportThe Cart Menu relies on the
wc-cart-fragmentsscript.
If you want to see the cart menu you will need to remove that snippet.From what I understand this helps lower load time on my website.
It simply disables a script that on very busy sites ( and maybe slower servers ) can cause delays.
You can always re-enable it, and if you notice a significant slow down ask your host if that script is the problem.April 20, 2022 at 5:56 am #2194661Deyson
Thank you David.
My website host has a Caching system. But, a page’s cache creation is triggered only after someone visits that page.
The page’s cache is not automatically created. It is only created after the first initial visit.So my goal is to try to shave off as much time as possible for those that see the page when it is uncached. Hence why I ran the script above.
Do you have any advice on what I should do?
Thank you and have an amazing day! ๐
April 20, 2022 at 6:09 am #2194674David
StaffCustomer SupportIf you really want to take advantage of Page Caching then you will need to keep the snippet to remove the fragments and do without the Cart Sub Menu.
April 20, 2022 at 6:12 am #2194678Deyson
Thank you.
Also is it possible to have the mini cart icon redirect to the checkout instead of the cart page?Thank you and have an amazing day! ๐
April 20, 2022 at 6:14 am #2194681David
StaffCustomer SupportIs it only that icon that will go straight to checkout ? or will all links to Cart go to Checkout ?
-
AuthorPosts
- You must be logged in to reply to this topic.